aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--simple-xdg-bdirs.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/simple-xdg-bdirs.h b/simple-xdg-bdirs.h
index e9aafc8..288b757 100644
--- a/simple-xdg-bdirs.h
+++ b/simple-xdg-bdirs.h
@@ -304,7 +304,8 @@ simple_xdg_bdirs_read_dirs(enum simple_xdg_bdirs_ftype type)
goto abort;
}
- strncpy(*cur, s2 + l1, l2 - l1);
+ if (l2 - l1 != 0)
+ strncpy(*cur, s2 + l1, l2 - l1);
(*cur)[l2 - l1] = '/';
(*cur)[l2 - l1 + 1] = '\0';