mirror of
https://github.com/sheumann/hush.git
synced 2024-10-12 01:24:10 +00:00
Be stricter when converting strings to integers. Should fix the problem
reported by Rob.
This commit is contained in:
parent
bbbe21d6b0
commit
7018385fe7
@ -158,11 +158,13 @@ static int toarith (VALUE *v)
|
|||||||
{
|
{
|
||||||
if(v->type == string) {
|
if(v->type == string) {
|
||||||
int i;
|
int i;
|
||||||
|
char *e;
|
||||||
|
|
||||||
/* Don't interpret the empty string as an integer. */
|
/* Don't interpret the empty string as an integer. */
|
||||||
if (v->u.s == 0)
|
/* Currently does not worry about overflow or int/long differences. */
|
||||||
|
i = (int) strtol(v->u.s, &e, 10);
|
||||||
|
if ((v->u.s == e) || *e)
|
||||||
return 0;
|
return 0;
|
||||||
i = atoi(v->u.s);
|
|
||||||
free (v->u.s);
|
free (v->u.s);
|
||||||
v->u.i = i;
|
v->u.i = i;
|
||||||
v->type = integer;
|
v->type = integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user