X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/181b6e789b79fc385e5ec75b2b83f01192d54051..fe1bb0e765883fa4149fba12daee81b6ae070de3:/parsing.c?ds=inline 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) { char *buf; + if (tail < head) + return xstrdup(""); buf = xmalloc(tail - head + 1); strncpy(buf, head, tail - head); buf[tail - head] = '\0';