aboutsummaryrefslogtreecommitdiff
path: root/libiberty/make-relative-prefix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libiberty/make-relative-prefix.c')
-rw-r--r--libiberty/make-relative-prefix.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c
index ec0b0ee..e3f9f92 100644
--- a/libiberty/make-relative-prefix.c
+++ b/libiberty/make-relative-prefix.c
@@ -1,5 +1,5 @@
/* Relative (relocatable) prefix support.
- Copyright (C) 1987-2019 Free Software Foundation, Inc.
+ Copyright (C) 1987-2020 Free Software Foundation, Inc.
This file is part of libiberty.
@@ -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;