]> granicus.if.org Git - nethack/commitdiff
windows vsprintf bit
authornhmall <nhmall@nethack.org>
Tue, 21 Jan 2020 01:58:40 +0000 (20:58 -0500)
committernhmall <nhmall@nethack.org>
Tue, 21 Jan 2020 01:59:41 +0000 (20:59 -0500)
sys/winnt/winnt.c

index 967fa6e4edc97bdf6a1e33ce831ec7f667621c3d..e7a2040a66bfbdee2ab594ff22614fe6309f04e8 100644 (file)
@@ -241,11 +241,11 @@ VA_DECL(const char *, s)
         end_screen();
     if (WINDOWPORT("tty")) {
         buf[0] = '\n';
-        (void) vsprintf(&buf[1], s, VA_ARGS);
+        (void) vsnprintf(&buf[1], sizeof buf - (1 + sizeof "\n"), s, VA_ARGS);
         Strcat(buf, "\n");
         msmsg(buf);
     } else {
-        (void) vsprintf(buf, s, VA_ARGS);
+        (void) vsnprintf(buf, sizeof buf - sizeof "\n", s, VA_ARGS);
         Strcat(buf, "\n");
         raw_printf(buf);
     }