]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libiberty/make-relative-prefix.c
Fix read buffer overflow in split_directories
[thirdparty/gcc.git] / libiberty / make-relative-prefix.c
index ec0b0ee74940831f760f0c9857b544df23c42baa..2ff2af8a59c65827b5dd815bf948bdf3a04b8075 100644 (file)
@@ -122,6 +122,9 @@ split_directories (const char *name, int *ptr_num_dirs)
   const char *p, *q;
   int ch;
 
+  if (!*name)
+    return NULL;
+
   /* Count the number of directories.  Special case MSDOS disk names as part
      of the initial directory.  */
   p = name;