diff options
author | Dave Reisner <d@falconindy.com> | 2011-03-23 23:19:28 -0400 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2011-03-23 23:19:28 -0400 |
commit | 3d4bf93a8ce123dd603163893aac0c3e5371c7c0 (patch) | |
tree | 61c0ff63cf3e315c33149bc51978c4fcb2493ea9 | |
parent | 7511a4b71ec0581a9d478d1a50887957f0d719e9 (diff) | |
download | expac-3d4bf93a8ce123dd603163893aac0c3e5371c7c0.tar.xz |
don't depend on format pointer reaching a NULL
-rw-r--r-- | expac.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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 == '%') { |