diff --git a/src/core/inttypes.c b/src/core/inttypes.c index b4c999b8..bed6dff1 100644 --- a/src/core/inttypes.c +++ b/src/core/inttypes.c @@ -73,13 +73,13 @@ static void *int64_unmarshal(JanetMarshalContext *ctx) { static void it_s64_tostring(void *p, JanetBuffer *buffer) { char str[32]; - sprintf(str, "%" PRId64, *((int64_t *)p)); + snprintf(str, sizeof(str), "%" PRId64, *((int64_t *)p)); janet_buffer_push_cstring(buffer, str); } static void it_u64_tostring(void *p, JanetBuffer *buffer) { char str[32]; - sprintf(str, "%" PRIu64, *((uint64_t *)p)); + snprintf(str, sizeof(str), "%" PRIu64, *((uint64_t *)p)); janet_buffer_push_cstring(buffer, str); } diff --git a/src/core/pp.c b/src/core/pp.c index 89ecc141..bba70b6b 100644 --- a/src/core/pp.c +++ b/src/core/pp.c @@ -830,7 +830,7 @@ static const char *scanformat( if (loc != NULL && *loc != '\0') { const char *mapping = get_fmt_mapping(*p2++); size_t len = strlen(mapping); - strcpy(form, mapping); + memcpy(form, mapping, len); form += len; } else { *(form++) = *(p2++);