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 32fdbd036bccaf45be36d79aca39010be921daeb..59240e017048a1901b5e8bbb218ee1b136fad596 100644 (file)
--- a/main.c
+++ b/main.c
@@ -58,7 +58,7 @@ char **envp;
     /*\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