From 91e4ca6c009966cede5d2c2f438bdde1036eeafb Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Sun, 20 Aug 2023 14:51:29 +0800 Subject: [PATCH] Fix signedness of type of pointer passed to snprintf snprintf takes a char* but the var was a uint8_t, which is unsigned char*. Suggested-by: gcc -Wpointer-sign Suggested-by: https://github.com/csutils/csmock See-also: https://github.com/pst-format/libpst/issues/6 --- src/libpst.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libpst.c b/src/libpst.c index 44ba866..7f3f015 100644 --- a/src/libpst.c +++ b/src/libpst.c @@ -4477,11 +4477,11 @@ void pst_rfc2231(pst_string *str) { strcpy(buffer, "utf-8''"); x = (int8_t *)str->str; const uint8_t *y = (uint8_t *)str->str; - uint8_t *z = (uint8_t *)buffer; + char *z = buffer; z += strlen(buffer); // skip the utf8 prefix while (*y) { if (*x <= 32) { - *(z++) = (uint8_t)'%'; + *(z++) = '%'; snprintf(z, 3, "%2" PRIx8, *y); z += 2; }