aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/pathstuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/common/pathstuff.c')
-rw-r--r--gdb/common/pathstuff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c
index e0e048d..b295e73 100644
--- a/gdb/common/pathstuff.c
+++ b/gdb/common/pathstuff.c
@@ -158,7 +158,7 @@ child_path (const char *parent, const char *child)
/* The parent path must be a directory and the child must contain at
least one component underneath the parent. */
const char *child_component;
- if (IS_DIR_SEPARATOR (parent[parent_len - 1]))
+ if (parent_len > 0 && IS_DIR_SEPARATOR (parent[parent_len - 1]))
{
/* The parent path ends in a directory separator, so it is a
directory. The first child component starts after the common