path-util: handle NULL inputs in last_path_component()

This commit is contained in:
Lennart Poettering
2018-11-26 18:09:01 +01:00
parent 5f7ecd610c
commit 77e0a1b5e0
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -750,6 +750,9 @@ const char *last_path_component(const char *path) {
unsigned l, k;
if (!path)
return NULL;
l = k = strlen(path);
if (l == 0) /* special case — an empty string */
return path;