Commit ec554a0f authored by Dag Haavi Finstad's avatar Dag Haavi Finstad

vsl -R: Add strtol underflow/overflow handling

parent 7854af8f
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment