]> granicus.if.org Git - nethack/commitdiff
buffer bit
authornhmall <nhmall@nethack.org>
Tue, 17 Dec 2019 06:17:49 +0000 (01:17 -0500)
committernhmall <nhmall@nethack.org>
Tue, 17 Dec 2019 06:17:49 +0000 (01:17 -0500)
sys/winnt/windmain.c

index b447ffcbd6df7c58f1194f464d816c310d3358cf..010c11eda4784a69b08770c8283196a6662f1220 100644 (file)
@@ -197,8 +197,8 @@ test_portable_config(
          */
 
          *portable_device_top_path = '\0';
-         (void) strncpy(tmppath, executable_path, sizeof tmppath - 1);
-         tmppath[sizeof tmppath - 1] = '\0';
+         (void) strncpy(tmppath, executable_path, sizeof tmppath - (1 + sizeof "sysconf"));
+         tmppath[sizeof tmppath - (1 + sizeof "sysconf")] = '\0';
          (void) strcat(tmppath, "sysconf");
          /* split the path up */
 #ifdef UNICODE