From 9d5352cb63d6daae68b26558d707a82b2b24fe6b Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Fri, 6 Jul 2018 13:22:44 +0000 Subject: [PATCH] r336028 changed next_msg to a char * from char [] of fixed size. Change 2nd argument of vsnprintf() to get the strlen of next_msg so that the appropriate size is used. Found with gcc. /usr.bin/top/display.c: In function 'new_message': /usr.bin/top/display.c:963:31: error: argument to 'sizeof' in 'vsnprintf' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] vsnprintf(next_msg, sizeof(next_msg), msgfmt, args); Reviewed by: daichi --- usr.bin/top/display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c index 0d94e8ff7918..dc041afb8354 100644 --- a/usr.bin/top/display.c +++ b/usr.bin/top/display.c @@ -960,7 +960,7 @@ new_message(int type, const char *msgfmt, ...) va_start(args, msgfmt); /* first, format the message */ - vsnprintf(next_msg, sizeof(next_msg), msgfmt, args); + vsnprintf(next_msg, strlen(next_msg), msgfmt, args); va_end(args);