diff options
author | Patrick McHardy <kaber@trash.net> | 2010-07-06 06:11:48 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-07-06 06:11:48 +0200 |
commit | 5b684d7ab74d014f30e61928aeec60684571fa5e (patch) | |
tree | 4759524acdba274b6877f6bf02c81c096c400bac /src/datatype.c | |
parent | 83e2a61e391fdb21911a1f2ff0cb04a80b68162a (diff) |
datatype: reject incompletely parsed integers in integer_type_parse()
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/datatype.c')
-rw-r--r-- | src/datatype.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/datatype.c b/src/datatype.c index 80271043..70670e97 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -215,9 +215,11 @@ static struct error_record *integer_type_parse(const struct expr *sym, struct expr **res) { mpz_t v; + int len; mpz_init(v); - if (gmp_sscanf(sym->identifier, "%Zu", v) != 1) { + if (gmp_sscanf(sym->identifier, "%Zu%n", v, &len) != 1 || + (int)strlen(sym->identifier) != len) { mpz_clear(v); if (sym->dtype != &integer_type) return NULL; |