[master] ec554a0f1 vsl -R: Add strtol underflow/overflow handling
Dag Haavi Finstad
daghf at varnish-software.com
Mon Dec 3 13:32:09 UTC 2018
commit ec554a0f1483c793c2e978ce935c2c8e9dacb3f9
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date: Mon Dec 3 14:31:35 2018 +0100
vsl -R: Add strtol underflow/overflow handling
diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c
index 2929b4ccf..c72d5a1a9 100644
--- a/lib/libvarnishapi/vsl_arg.c
+++ b/lib/libvarnishapi/vsl_arg.c
@@ -310,7 +310,10 @@ vsl_R_arg(struct VSL_data *vsl, const char *arg)
AN(arg);
CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC);
+ errno = 0;
l = strtol(arg, &p, 0);
+ if ((l == LONG_MIN || l == LONG_MAX) && errno == ERANGE)
+ return (vsl_diag(vsl, "-R: Range error"));
if (l <= 0 || l > INT_MAX)
return (vsl_diag(vsl, "-R: Range error"));
vsl->R_opt_l = l;
More information about the varnish-commit
mailing list