[master] d8274da Fix a end-of-string mistake (spotted by FlexeLint)
Poul-Henning Kamp
phk at FreeBSD.org
Wed Jun 6 16:52:24 UTC 2018
commit d8274da4d3a5ab3d42536516f0bc76f14f5d3f10
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 488027d..c92b0a3 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