Skip to content

Commit

Permalink
Fix signedness of type of pointer passed to snprintf
Browse files Browse the repository at this point in the history
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: #6
  • Loading branch information
pabs3 committed Aug 20, 2023
1 parent 7273ec8 commit 91e4ca6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libpst.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 91e4ca6

Please sign in to comment.