Просмотр исходного кода

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 лет назад
Родитель
Сommit
5eacc5df82
1 измененных файлов с 2 добавлено и 1 удалено
  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
 		 */