[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r13678 - in /fsf/trunk/libc: ChangeLog elf/ldconfig.c



Author: eglibc
Date: Wed May  4 00:03:33 2011
New Revision: 13678

Log:
Import glibc-mainline for 2011-05-04

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/elf/ldconfig.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed May  4 00:03:33 2011
@@ -1,3 +1,7 @@
+2011-05-03  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* elf/ldconfig.c (add_dir): Don't crash on empty path.
+
 2011-04-28  Maciej Babinski  <mbabinski@xxxxxxxxxx>
 
 	[BZ #12714]

Modified: fsf/trunk/libc/elf/ldconfig.c
==============================================================================
--- fsf/trunk/libc/elf/ldconfig.c (original)
+++ fsf/trunk/libc/elf/ldconfig.c Wed May  4 00:03:33 2011
@@ -384,14 +384,17 @@
     }
 
   /* Canonify path: for now only remove leading and trailing
-     whitespace and the trailing slashes slashes.  */
-  i = strlen (entry->path) - 1;
-
-  while (isspace (entry->path[i]) && i > 0)
-    entry->path[i--] = '\0';
-
-  while (entry->path[i] == '/' && i > 0)
-    entry->path[i--] = '\0';
+     whitespace and the trailing slashes.  */
+  i = strlen (entry->path);
+
+  while (i > 0 && isspace (entry->path[i - 1]))
+    entry->path[--i] = '\0';
+
+  while (i > 0 && entry->path[i - 1] == '/')
+    entry->path[--i] = '\0';
+
+  if (i == 0)
+    return;
 
   char *path = entry->path;
   if (opt_chroot)