Răsfoiți Sursa

Don't clobber stack on strings with length of zero.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1874 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 17 ani în urmă
părinte
comite
5eacc5df82
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 2 1
      exec/coroparse.c

+ 2 - 1
exec/coroparse.c

@@ -91,7 +91,8 @@ static int parse_section(FILE *fp,
 	char *loc;
 
 	while (fgets (line, 255, fp)) {
-		line[strlen(line) - 1] = '\0';
+		if (strlen(line) > 0)
+			line[strlen(line) - 1] = '\0';
 		/*
 		 * Clear out white space and tabs
 		 */