]> gitweb.ps.run Git - ps-cgit/commitdiff
Check for NULL commit buffer in cgit_parse_commit()
authorOndrej Jirman <ondrej.jirman@zonio.net>
Sat, 26 May 2007 01:27:49 +0000 (03:27 +0200)
committerLars Hjemli <hjemli@gmail.com>
Thu, 31 May 2007 08:24:43 +0000 (10:24 +0200)
This can be NULL, so try not to segfault.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
parsing.c

index b86467aed5a8720d6bbd829fe81cc852410e8dc9..74a248449f35fb2a5331f571d3bea30a2806acab 100644 (file)
--- a/parsing.c
+++ b/parsing.c
@@ -200,6 +200,9 @@ struct commitinfo *cgit_parse_commit(struct commit *commit)
        ret->subject = NULL;
        ret->msg = NULL;
 
        ret->subject = NULL;
        ret->msg = NULL;
 
+       if (p == NULL)
+               return ret;
+
        if (strncmp(p, "tree ", 5))
                die("Bad commit: %s", sha1_to_hex(commit->object.sha1));
        else
        if (strncmp(p, "tree ", 5))
                die("Bad commit: %s", sha1_to_hex(commit->object.sha1));
        else