Commit 584c2f1d authored by Stefano Sabatini's avatar Stefano Sabatini

cmdutils: add OPT_INT check in parse_number_or_die()

Check that the value passed for an OPT_INT option is an int, fail
parent 3c10843f
......@@ -106,6 +106,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
error= "The value for %s was %s which is not within %f - %f\n";
else if(type == OPT_INT64 && (int64_t)d != d)
error= "Expected int64 for %s but found %s\n";
else if (type == OPT_INT && (int)d != d)
error= "Expected int for %s but found %s\n";
return d;
fprintf(stderr, error, context, numstr, min, max);
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