mirror of
https://git.zx2c4.com/cgit
synced 2024-12-22 23:21:52 +00:00
Fix segmentation fault in empty repository
When a repository is empty, the ATOM feed link is written in the header, but this involves formatting ctx->qry.head which is NULL in this case. With glibc, vsnprintf formats "%s" with a NULL input as "(null)" but on Solaris this results in a segmentation fault. Since we don't have a meaningful head for the atom feed in an empty repository, it's simplest not to write out the link element at all. Signed-off-by: John Keeping <john@metanate.com>
This commit is contained in:
parent
fbd254d54e
commit
94b7c76e53
@ -619,7 +619,7 @@ void cgit_print_docstart(struct cgit_context *ctx)
|
||||
html_attr(ctx->cfg.favicon);
|
||||
html("'/>\n");
|
||||
}
|
||||
if (host && ctx->repo) {
|
||||
if (host && ctx->repo && ctx->qry.head) {
|
||||
html("<link rel='alternate' title='Atom feed' href='");
|
||||
html(cgit_httpscheme());
|
||||
html_attr(cgit_hosturl());
|
||||
|
Loading…
Reference in New Issue
Block a user