From 81f9a67d6f6931c4c116b67a0fbccfbdf6cbb7e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Thu, 13 Sep 2018 17:16:43 +0200 Subject: [PATCH] libvmdump: Increase message buffer size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The message buffer of DumpException doesn't account for additional strings such as strerror(), device nodes, or filenames. Make it a bit larger to be safe. This fixes the following GCC8 compile warnings: In file included from vm_dump.h:62, from vm_dump.cpp:17: dump.h: In static member function ‘static Dump::DumpType VMDump::getDumpType(const char*)’: dump.h:46:16: warning: ‘ (’ directive writing 2 bytes into a region of size between 1 and 200 [-W format-overflow=] sprintf(msg, "%s (%s)", m, strerror(errno)); ^~~~~~~~~ dump.h:46:10: note: ‘sprintf’ output 4 or more bytes (assuming 203) into a destination of size 200 sprintf(msg, "%s (%s)", m, strerror(errno)); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ dump.h:46:16: warning: ‘ (’ directive writing 2 bytes into a region of size between 1 and 200 [-W format-overflow=] sprintf(msg, "%s (%s)", m, strerror(errno)); ^~~~~~~~~ dump.h:46:10: note: ‘sprintf’ output 4 or more bytes (assuming 203) into a destination of size 200 sprintf(msg, "%s (%s)", m, strerror(errno)); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ dump.h:46:16: warning: ‘ (’ directive writing 2 bytes into a region of size between 1 and 200 [-W format-overflow=] sprintf(msg, "%s (%s)", m, strerror(errno)); ^~~~~~~~~ dump.h:46:10: note: ‘sprintf’ output 4 or more bytes (assuming 203) into a destination of size 200 sprintf(msg, "%s (%s)", m, strerror(errno)); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jan Höppner --- libvmdump/dump.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvmdump/dump.h b/libvmdump/dump.h index 971f6006..60d4e4b6 100644 --- a/libvmdump/dump.h +++ b/libvmdump/dump.h @@ -35,7 +35,7 @@ public: const char *what(void) const { return msg; } int code(void) const { return errorCode; } protected: - char msg[200]; + char msg[2048]; int errorCode; };