From 3d4bf93a8ce123dd603163893aac0c3e5371c7c0 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 23 Mar 2011 23:19:28 -0400 Subject: don't depend on format pointer reaching a NULL --- expac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/expac.c b/expac.c index dc513d1..df1da11 100644 --- a/expac.c +++ b/expac.c @@ -344,11 +344,13 @@ static int print_time(time_t timestamp) { } static int print_pkg(pmpkg_t *pkg, const char *format) { - const char *f; + const char *f, *end; char fmt[32]; int len, out = 0; - for (f = format; *f != '\0'; f++) { + end = rawmemchr(format, '\0'); + + for (f = format; f < end; f++) { bool shortdeps = false; len = 0; if (*f == '%') { -- cgit v1.2.3-70-g09d2