summaryrefslogtreecommitdiff
path: root/lib/header.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/header.c')
-rw-r--r--lib/header.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/header.c b/lib/header.c
index f6d2b0033..cf04c4535 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -409,7 +409,8 @@ unsigned headerSizeof(Header h, int magicp)
static inline int strtaglen(const char *str, rpm_count_t c, const char *end)
{
const char *start = str;
- const char *s;
+ const char *s = NULL;
+ int len = -1; /* assume failure */
if (end) {
while (end > start && (s = memchr(start, '\0', end-start))) {
@@ -424,7 +425,11 @@ static inline int strtaglen(const char *str, rpm_count_t c, const char *end)
start = s + 1;
}
}
- return (c > 0) ? -1 : (s - str + 1);
+
+ if (s != NULL && c == 0)
+ len = s - str + 1;
+
+ return len;
}
/**