소스 검색

Fix error where pathlist buffer is overrun resulting in segfault

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1072 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 19 년 전
부모
커밋
503d46f021
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      lcr/lcr_ifact.c

+ 8 - 4
lcr/lcr_ifact.c

@@ -195,6 +195,7 @@ static void ld_library_path_build (void)
 	for (i = 0, p_s = my_ld_library_path, i = 0; i < len; i++) {
 		if (my_ld_library_path[i] == ':' || my_ld_library_path[i] == '\0') {
 			my_ld_library_path[i]='\0';
+//printf ("path list %x path list entries %d\n", path_list, path_list_entries);
 			path_list[path_list_entries++] = strdup (p_s);
 			p_s = &my_ld_library_path[i];
 		}
@@ -319,6 +320,7 @@ found:
 	return (0);
 }
 
+static unsigned int lcr_initialized = 0;
 
 int lcr_ifact_reference (
 	unsigned int *iface_handle,
@@ -341,10 +343,12 @@ int lcr_ifact_reference (
 		goto found;
 	}
 
-	defaults_path_build ();
-	ld_library_path_build ();
-	ldso_path_build ("/etc", "ld.so.conf");
-
+	if (lcr_initialized == 0) {
+		lcr_initialized = 1;
+		defaults_path_build ();
+		ld_library_path_build ();
+		ldso_path_build ("/etc", "ld.so.conf");
+	}
 
 // TODO error checking in this code is weak
 	/*