[Reconnoiter-devel] [reconnoiter commit] r740 - trunk/src/noitedit

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Tue Jun 9 10:11:48 EDT 2009


Author: jesus
Date: 2009-06-09 10:11:47 -0400 (Tue, 09 Jun 2009)
New Revision: 740

Modified:
   trunk/src/noitedit/readline.c
Log:
closes #143

Modified: trunk/src/noitedit/readline.c
===================================================================
--- trunk/src/noitedit/readline.c	2009-06-08 22:41:28 UTC (rev 739)
+++ trunk/src/noitedit/readline.c	2009-06-09 14:11:47 UTC (rev 740)
@@ -1326,8 +1326,10 @@
 	/* first slash */
 	txt += len;
 
-	temp = malloc(strlen(pass->pw_dir) + 1 + strlen(txt) + 1);
-	(void) sprintf(temp, "%s/%s", pass->pw_dir, txt);
+	/* Reuse len to use snprintf */
+	len = strlen(pass->pw_dir) + 1 + strlen(txt) + 1;
+	temp = malloc(len);
+	(void) snprintf(temp, len, "%s/%s", pass->pw_dir, txt);
 
 	return (temp);
 #endif
@@ -1414,7 +1416,7 @@
 #endif
 		    ((dirname) ? strlen(dirname) : 0) + 1 + 1;
 		temp = malloc(len);
-		(void) sprintf(temp, "%s%s",
+		(void) snprintf(temp, len, "%s%s",
 		    dirname ? dirname : "", entry->d_name);	/* safe */
 
 		/* test, if it's directory */



More information about the Reconnoiter-devel mailing list