[6.0] 4bffcce48 Fix a end-of-string mistake (spotted by FlexeLint)
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Thu Aug 16 08:53:09 UTC 2018
commit 4bffcce48c5e2cdc152c8c86e567298bd9ea8088
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jun 6 16:46:42 2018 +0000
Fix a end-of-string mistake (spotted by FlexeLint)
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 488027d0e..c92b0a317 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -692,13 +692,12 @@ parse_format(const char *format)
for (p = format; *p != '\0'; p++) {
/* Allow the most essential escape sequences in format */
- if (*p == '\\') {
- p++;
- if (*p == 't')
+ if (*p == '\\' && p[1] != '\0') {
+ if (*++p == 't')
AZ(VSB_putc(vsb, '\t'));
else if (*p == 'n')
AZ(VSB_putc(vsb, '\n'));
- else if (*p != '\0')
+ else
AZ(VSB_putc(vsb, *p));
continue;
}
More information about the varnish-commit
mailing list