From 848cf430c4393555f35f4e4d27da8a555f6308c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Sun, 10 Nov 2019 11:51:00 +0100 Subject: [PATCH] [libiberty] Fix read buffer overflow in split_directories() * libiberty/make-relative-prefix.c: Return early on empty 'name' --- libiberty/make-relative-prefix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c index ec0b0ee749..2ff2af8a59 100644 --- a/libiberty/make-relative-prefix.c +++ b/libiberty/make-relative-prefix.c @@ -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; -- 2.24.0