From c747e8d16c743ec2db8bd81cb7be563d80a8038f Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Wed, 15 May 2024 18:20:20 -0500 Subject: [PATCH] Address some compiler linter messages on openbsd --- src/core/inttypes.c | 4 ++-- src/core/pp.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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++);