about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--parsing.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/parsing.c b/parsing.c index 602e3de..1b2a551 100644 --- a/parsing.c +++ b/parsing.c
@@ -56,6 +56,8 @@ char *substr(const char *head, const char *tail)
56{ 56{
57 char *buf; 57 char *buf;
58 58
59 if (tail < head)
60 return xstrdup("");
59 buf = xmalloc(tail - head + 1); 61 buf = xmalloc(tail - head + 1);
60 strncpy(buf, head, tail - head); 62 strncpy(buf, head, tail - head);
61 buf[tail - head] = '\0'; 63 buf[tail - head] = '\0';