From c1ea0601c9092a1c2e10acf32bc8bf0d1f8d13b3 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 2 Apr 2026 11:14:30 +0200 Subject: [PATCH] tweaks: defend against hypothetical format specifiers With this change, any format specifiers that the now third parameter of statusline() *might* contain will not lead to unintended accesses of memory. Suggested-by: Jonathan Echavarria Signed-off-by: Benno Schulenberg --- src/files.c | 2 +- src/winio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/files.c b/src/files.c index 7ae1389e..a8a37cc9 100644 --- a/src/files.c +++ b/src/files.c @@ -781,7 +781,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable) /* If there was a real error during the reading, let the user know. */ if (ferror(f) && errornumber != EINTR && errornumber != 0) - statusline(ALERT, strerror(errornumber)); + statusline(ALERT, "%s", strerror(errornumber)); if (control_C_was_pressed) statusline(ALERT, _("Interrupted")); diff --git a/src/winio.c b/src/winio.c index 14855f48..8f4d790d 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2421,7 +2421,7 @@ void statusbar(const char *msg) void warn_and_briefly_pause(const char *msg) { blank_bottombars(); - statusline(ALERT, msg); + statusline(ALERT, "%s", msg); lastmessage = VACUUM; napms(1500); }