It it possible to inspect blobs by specifying only the SHA-1, and CGit provides links to do so, for example if a tag points directly at a blob. In this case the path_items structure is never used, but creating it still causes strlen to be run on a null pointer. Fix this.
This error was introduced by commit c1633c6 (Update git to v1.7.6.5 - 2013-03-02). Signed-off-by: John Keeping <[email protected]> --- You can see this by inspecting the "larsh-public-key" tag in cgit.git. I noticed this because I was running under Clang's address sanitizer, which also meant I had compiled with -O1, I wonder if this could be optimized away at higher optimization levels. ui-blob.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-blob.c b/ui-blob.c index c59fbcb..7aec0b1 100644 --- a/ui-blob.c +++ b/ui-blob.c @@ -80,7 +80,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head) struct commit *commit; struct pathspec_item path_items = { .match = path, - .len = strlen(path) + .len = path ? strlen(path) : 0 }; struct pathspec paths = { .nr = 1, -- 1.8.2.692.g17a9715 _______________________________________________ cgit mailing list [email protected] http://hjemli.net/mailman/listinfo/cgit
