dtcalc: Coverity (memory corruption, moderate)
authorJon Trulson <jon@radscan.com>
Fri, 26 Dec 2014 23:17:43 +0000 (16:17 -0700)
committerJon Trulson <jon@radscan.com>
Fri, 26 Dec 2014 23:17:43 +0000 (16:17 -0700)
cde/programs/dtcalc/calctool.c

index 44e5aaadb7b239a8df2731d84fae1cc18c23de59..3615055a4a690251dc014fe03139271af0ba4966 100644 (file)
@@ -1638,10 +1638,10 @@ read_rcfiles(void)   /* Read .dtcalcrc's from home and current directories. */
       if ((entry = getpwuid(getuid())) == NULL) return ;
       home = entry->pw_dir ;
     }
-  SPRINTF(name, "%s/%s", home, RCNAME) ;
+  snprintf(name, MAXPATHLEN, "%s/%s", home, RCNAME) ;
   get_rcfile(name) ;      /* Read .dtcalcrc from users home directory. */
  
-  SPRINTF(name, "%s/%s", getcwd(pathname, MAXPATHLEN+1), RCNAME) ;
+  snprintf(name, MAXPATHLEN, "%s/%s", getcwd(pathname, MAXPATHLEN+1), RCNAME) ;
   get_rcfile(name) ;      /* Read .dtcalcrc file from current directory. */
 }