summaryrefslogtreecommitdiffstats
path: root/expac.c
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-03-23 23:19:28 -0400
committerDave Reisner <d@falconindy.com>2011-03-23 23:19:28 -0400
commit3d4bf93a8ce123dd603163893aac0c3e5371c7c0 (patch)
tree61c0ff63cf3e315c33149bc51978c4fcb2493ea9 /expac.c
parent7511a4b71ec0581a9d478d1a50887957f0d719e9 (diff)
downloadexpac-3d4bf93a8ce123dd603163893aac0c3e5371c7c0.tar.xz
don't depend on format pointer reaching a NULL
Diffstat (limited to 'expac.c')
-rw-r--r--expac.c6
1 files 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 == '%') {