aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index c3337e4386..6433b32983 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -919,7 +919,8 @@ open_path (const char *name, size_t namelen, int preloaded,
test whether there is any directory at all. */
struct stat st;
- buf[this_dir->dirnamelen + capstr[cnt].len] = '\0';
+ buf[this_dir->dirnamelen
+ + MAX (capstr[cnt].len - 1, 0)] = '\0';
if (__xstat (_STAT_VER, buf, &st) != 0
|| ! S_ISDIR (st.st_mode))