From: nhmall Date: Thu, 10 Dec 2015 12:51:33 +0000 (-0500) Subject: fixes updates for win32gui X-Git-Tag: NetHack-3.6.1_RC01~1196 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=375a2c28f153976aff42e125e3fed35b7d9670f8;p=nethack fixes updates for win32gui Changes to be committed: modified: doc/fixes36.0 modified: doc/fixes36.1 modified: win/win32/mhsplash.c modified: win/win32/mswproc.c --- diff --git a/doc/fixes36.0 b/doc/fixes36.0 index cc4947cbe..b285f4ab9 100644 --- a/doc/fixes36.0 +++ b/doc/fixes36.0 @@ -1185,6 +1185,7 @@ win32gui: added menu options "Copy ASCII Screenshot To Clipboard" and "Save win32gui, win32tty: add support for looking for sysconf in %COMMONPROGRAMFILES% first and for user config file in %USERPROFILE% (improves support for multi-login Windows environments) +win32gui: missing sys_early_init() call could result in "rnd(0) attempted" win32tty: support for 'selectsaved' option for menu of existing save files to choose from at game startup tty: add window port routines for saving/restoring message history diff --git a/doc/fixes36.1 b/doc/fixes36.1 index aad10e4c3..5dee5921f 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -15,7 +15,8 @@ Platform- and/or Interface-Specific Fixes ----------------------------------------- unix/X11: in top level Makefile, some commented out definitions of VARDATND misspelled pilemark.xbm (as pilemark.xpm) -win32gui: missing sys_early_init() call could result in "rnd(0) attempted" +win32gui: getversionstring() was overflowing the provided Help About buffer +win32gui: guard against buffer overflow in in mswin_getlin() MacOSX: initial binary release was built from out of date source code that had 'BETA' and 'DEBUG' inappropriately enabled X11: core bug for '`' (backtick) command was only noticed by X11 interface, diff --git a/win/win32/mhsplash.c b/win/win32/mhsplash.c index 4d2277249..680da598e 100644 --- a/win/win32/mhsplash.c +++ b/win/win32/mhsplash.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhsplash.c $NHDT-Date: 1432512813 2015/05/25 00:13:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ */ +/* NetHack 3.6 mhsplash.c $NHDT-Date: 1449751714 2015/12/10 12:48:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.27 $ */ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ @@ -94,11 +94,24 @@ mswin_display_splash_window(BOOL show_ver) if (show_ver) { /* Show complete version information */ dlb *f; + char verbuf[BUFSZ]; + int verstrsize = 0; + + getversionstring(verbuf); + verstrsize = strlen(verbuf); + if (verstrsize + strlen("\r\n\r\n") + 1 < BUFSZ - 1) + strcat(verbuf, "\r\n\r\n"); + verstrsize = strlen(verbuf); - getversionstring(buf + strsize); - strcat(buf, "\r\n\r\n"); + if (strsize + verstrsize + 1 > bufsize) { + bufsize += BUFSZ; + buf = realloc(buf, bufsize); + if (buf == NULL) + panic("out of memory"); + } + strcat(buf, verbuf); strsize = strlen(buf); - + /* Add compile options */ f = dlb_fopen(OPTIONS_USED, RDTMODE); if (f) { diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 593131ad5..e4f890260 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mswproc.c $NHDT-Date: 1449116670 2015/12/03 04:24:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.94 $ */ +/* NetHack 3.6 mswproc.c $NHDT-Date: 1449751720 2015/12/10 12:48:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.95 $ */ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ @@ -12,6 +12,7 @@ #include "func_tab.h" /* for extended commands */ #include "winMS.h" #include +#include #include "mhmap.h" #include "mhstatus.h" #include "mhtext.h" @@ -1640,6 +1641,8 @@ mswin_getlin(const char *question, char *input) if (len > 0) len--; input[len] = '\0'; + } else if (len>=(BUFSZ-1)) { + PlaySound((LPCSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID|SND_ASYNC); } else { input[len++] = c; input[len] = '\0';