summaryrefslogtreecommitdiff
path: root/src/depend/depend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/depend/depend.cpp')
-rw-r--r--src/depend/depend.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/depend/depend.cpp b/src/depend/depend.cpp
index 133a7b676..8510f0ecd 100644
--- a/src/depend/depend.cpp
+++ b/src/depend/depend.cpp
@@ -426,7 +426,8 @@ const char *GeneratePath(const char *dirname, const char *filename, bool local)
/* Remove '..' from the begin of the filename. */
while (*p == '.') {
if (*(++p) == '.') {
- *(strrchr(path, '/')) = '\0';
+ char *s = strrchr(path, '/');
+ if (s != NULL) *s = '\0';
p += 2;
}
}
@@ -443,7 +444,8 @@ const char *GeneratePath(const char *dirname, const char *filename, bool local)
/* Remove '..' from the begin of the filename. */
while (*p == '.') {
if (*(++p) == '.') {
- *(strrchr(path, '/')) = '\0';
+ char *s = strrchr(path, '/');
+ if (s != NULL) *s = '\0';
p += 2;
}
}