From 8e5c96c318170214979dffdac673dbfe39e0f8d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Torbj=C3=B6rn=20SVENSSON?= Date: Fri, 9 Jun 2023 16:09:53 +0200 Subject: [PATCH] Fix GCC compile warning format-security on Windows * src/job.c (create_batch_file): Avoid non-static format strings. * src/main.c (handle_runtime_exceptions): Ditto. * src/w32/subproc/w32err.c (map_windows32_error_to_string): Ditto. --- src/job.c | 2 +- src/main.c | 4 ++-- src/w32/subproc/w32err.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/job.c b/src/job.c index 34ef9b80..f7f97010 100644 --- a/src/job.c +++ b/src/job.c @@ -362,7 +362,7 @@ create_batch_file (char const *base, int unixy, int *fd) *fd = -1; if (error_string == NULL) error_string = _("Cannot create a temporary file"); - O (fatal, NILF, error_string); + OS (fatal, NILF, "%s", error_string); /* not reached */ return NULL; diff --git a/src/main.c b/src/main.c index 9ec8f20a..26d6ba34 100644 --- a/src/main.c +++ b/src/main.c @@ -955,7 +955,7 @@ handle_runtime_exceptions (struct _EXCEPTION_POINTERS *exinfo) sprintf (errmsg, _("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%p)\n"), prg, exrec->ExceptionCode, exrec->ExceptionAddress); - fprintf (stderr, errmsg); + fputs (errmsg, stderr); exit (255); } @@ -994,7 +994,7 @@ handle_runtime_exceptions (struct _EXCEPTION_POINTERS *exinfo) #endif /* Write the error to stderr too */ - fprintf (stderr, errmsg); + fputs (errmsg, stderr); #ifdef DEBUG return EXCEPTION_CONTINUE_SEARCH; diff --git a/src/w32/subproc/w32err.c b/src/w32/subproc/w32err.c index e947a5b2..42ca595c 100644 --- a/src/w32/subproc/w32err.c +++ b/src/w32/subproc/w32err.c @@ -56,7 +56,7 @@ map_windows32_error_to_string (DWORD ercode) { * Special code for winsock error handling. */ if (ercode > WSABASEERR) { - O (fatal, NILF, szMessageBuffer); + OS (fatal, NILF, "%s", szMessageBuffer); } /* -- 2.47.3