Prevent crash due to buffer overflow detection (and on some platforms probably actual...
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Thu, 4 Apr 2013 10:11:27 +0000 (12:11 +0200)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Thu, 4 Apr 2013 10:11:27 +0000 (12:11 +0200)
main.c

diff --git a/main.c b/main.c
index 32fdbd0..59240e0 100644 (file)
--- a/main.c
+++ b/main.c
@@ -58,7 +58,7 @@ char **envp;
     /*\r
      * get home and options from environment\r
      */\r
     /*\r
      * get home and options from environment\r
      */\r
-    strncpy(home, md_gethomedir(), PATH_MAX);\r
+    strncpy(home, md_gethomedir(), sizeof(home) - 1);\r
 \r
     strcpy(file_name, home);\r
     strcat(file_name, "rogue36.sav");\r
 \r
     strcpy(file_name, home);\r
     strcat(file_name, "rogue36.sav");\r