From: Michael Tremer Date: Sat, 1 Jun 2019 02:44:40 +0000 (+0100) Subject: libpakfire: parser: Fix when namespace is NULL X-Git-Tag: 0.9.28~1285^2~1009 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9fd0a91901c34df1dd6682c84215cd0dd7a191e;p=pakfire.git libpakfire: parser: Fix when namespace is NULL Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/parser.c b/src/libpakfire/parser.c index 60d0f0b31..81b216a24 100644 --- a/src/libpakfire/parser.c +++ b/src/libpakfire/parser.c @@ -261,13 +261,13 @@ static struct pakfire_parser_declaration* pakfire_parser_find_declaration( // Create a working copy of the namespace char* n = pakfire_strdup(parser->namespace); - size_t length = strlen(n) + strlen(name) + 1; + size_t length = (n) ? strlen(n) : 0 + strlen(name) + 1; char* buffer = pakfire_malloc(length + 1); struct pakfire_parser_declaration* d = NULL; while (1) { - if (*n) + if (n && *n) snprintf(buffer, length + 1, "%s.%s", n, name); else snprintf(buffer, length + 1, "%s", name);