From dcf8c35f9b053a8b4d498cbf4a63ee2b8dba6774 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Debian Linux)" <rob@synchro.net> Date: Wed, 29 Mar 2023 12:15:41 -0700 Subject: [PATCH] Resolve GCC 12.2 warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘void *’ warning: ‘sprintf’ writing a terminating nul past the end of the destination --- src/syncterm/term.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/syncterm/term.c b/src/syncterm/term.c index 6b5ca259b4..95daeb1501 100644 --- a/src/syncterm/term.c +++ b/src/syncterm/term.c @@ -2230,7 +2230,7 @@ capture_control(struct bbslist *bbs) if ((tm = localtime(&t)) != NULL) { // The null-terminator // overwrites the first // byte of filesize - sprintf(sauce.date, "%04u%02u%02u", + snprintf(sauce.date, sizeof(sauce.date), "%04u%02u%02u", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday); } sauce.filesize = LE_INT32(ftell(fp)); // LE @@ -2949,7 +2949,7 @@ draw_ppm_str_handler(char *str, size_t slen, char *fn, void *apcd) } if (mask != NULL) { - if (asprintf(&maskfn, "%s%s", fn, mask) < 0) + if (asprintf(&maskfn, "%s%s", fn, (char*)mask) < 0) goto done; } @@ -3231,7 +3231,7 @@ paste_pixmap(char *str, size_t slen, char *fn, void *apcd) } if (mask != NULL) { - if (asprintf(&maskfn, "%s%s", fn, mask) < 0) + if (asprintf(&maskfn, "%s%s", fn, (char*)mask) < 0) goto done; } -- GitLab