[master] 0aa0836 Use strncmp to avoid potential overruns
Federico G. Schwindt
fgsch at lodoss.net
Tue Aug 15 10:32:16 CEST 2017
commit 0aa08363a015a2f2add8b258823d736bcb579b92
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Tue Aug 15 09:29:42 2017 +0100
Use strncmp to avoid potential overruns
diff --git a/lib/libvarnishapi/vjsn.c b/lib/libvarnishapi/vjsn.c
index 10a8faf..c4d2254 100644
--- a/lib/libvarnishapi/vjsn.c
+++ b/lib/libvarnishapi/vjsn.c
@@ -373,15 +373,15 @@ vjsn_value(struct vjsn *js)
AN(jsv->value);
return (jsv);
}
- if (!memcmp(js->ptr, "true", 4)) {
+ if (!strncmp(js->ptr, "true", 4)) {
js->ptr += 4;
return (vjsn_val_new(VJSN_TRUE));
}
- if (!memcmp(js->ptr, "false", 5)) {
+ if (!strncmp(js->ptr, "false", 5)) {
js->ptr += 5;
return (vjsn_val_new(VJSN_FALSE));
}
- if (!memcmp(js->ptr, "null", 4)) {
+ if (!strncmp(js->ptr, "null", 4)) {
js->ptr += 4;
return (vjsn_val_new(VJSN_NULL));
}
More information about the varnish-commit
mailing list