Przeglądaj źródła

Dont clobber stck on strings with length of zero.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1875 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 17 lat temu
rodzic
commit
06483f4900
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      lcr/lcr_ifact.c

+ 2 - 1
lcr/lcr_ifact.c

@@ -243,7 +243,8 @@ static int ldso_path_build (const char *path, const char *filename)
 	}
 
 	while (fgets (string, sizeof (string), fp)) {
-		string[strlen(string) - 1] = '\0';
+		if (strlen(string) > 0)
+			string[strlen(string) - 1] = '\0';
 		if (strncmp (string, "include", strlen ("include")) == 0) {
 			newpath_tmp = string + strlen ("include") + 1;
 			for (j = strlen (string);