summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-05-20 13:04:08 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-05-20 13:06:44 -0700
commitab11cfec562772e540468fc861d8acb1a38b5fad (patch)
tree32043c6aa0970fcc294dcc96b609035f72034619
parent5b0c98895caa066a760384cf1967ceb966151f04 (diff)
Fix #1: Segmentation fault on trailing slashes
dodir may pass a NULL pointer for the **p argument so we verify the pointer is not NULL before dereferencing it. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--lndir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lndir.c b/lndir.c
index afd5aa4..7b84fa7 100644
--- a/lndir.c
+++ b/lndir.c
@@ -127,7 +127,7 @@ equivalent(char *lname, const char *rname, char **p)
while (s[1] == '/') {
size_t len = strlen(s+2);
memmove(s+1, s+2, len+1);
- if (*p) (*p)--;
+ if (p && *p) (*p)--;
}
}
return !strcmp(lname, rname);