Skip to content
Browse files

don't depend on format pointer reaching a NULL

  • Loading branch information...
1 parent 7511a4b commit 3d4bf93a8ce123dd603163893aac0c3e5371c7c0 @falconindy committed Mar 23, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 expac.c
View
6 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 == '%') {

0 comments on commit 3d4bf93

Please sign in to comment.
Something went wrong with that request. Please try again.