]> git.cameronkatri.com Git - cgit.git/blobdiff - parsing.c
ui-repolist: do not use agefile if it's date could not be parsed
[cgit.git] / parsing.c
index 151c0fe468c64174ae260ba9b5ddd2d8de52e81e..1b2a551417f621733eaa4c5bbe2d5e8bf3de75dc 100644 (file)
--- 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';
@@ -125,7 +127,7 @@ const char *reencode(char **txt, const char *src_enc, const char *dst_enc)
 struct commitinfo *cgit_parse_commit(struct commit *commit)
 {
        struct commitinfo *ret;
-       char *p = commit->buffer, *t = commit->buffer;
+       char *p = commit->buffer, *t;
 
        ret = xmalloc(sizeof(*ret));
        ret->commit = commit;