summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/util.c b/util.c
index 2be0f19..b146c82 100644
--- a/util.c
+++ b/util.c
@@ -167,6 +167,7 @@ size_t strn_len(const char *src, size_t n) {
// duplicates at most n characters from src
char *strn_dup(const char *src, size_t n) {
+ if (!src) return NULL;
size_t len = strn_len(src, n);
if (n > len)
n = len;