summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Ekstrom <joey@ryati.com>2011-07-20 14:08:25 -0600
committerLloyd Hilaiel <lloyd@hilaiel.com>2011-12-19 16:11:53 -0700
commit52d60b8f6a42e8b04ab2fa323ef338a9231d1b97 (patch)
treed6afbf12ac655c30f3aa3f3cb542d1e1b3b3b0b9
parentb0ea41643e411730b8411e282b229d98d5eb38b6 (diff)
downloadyajl-52d60b8f6a42e8b04ab2fa323ef338a9231d1b97.tar.gz
Added error case for yajl_parse_integer "integer" to check the
characters are between 0-9, and setting an error case otherwise. Signed-off-by: Lloyd Hilaiel <lloyd@hilaiel.com>
-rw-r--r--src/yajl_parser.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/yajl_parser.c b/src/yajl_parser.c
index 2cf8a07..9788022 100644
--- a/src/yajl_parser.c
+++ b/src/yajl_parser.c
@@ -51,6 +51,10 @@ yajl_parse_integer(const unsigned char *number, unsigned int length)
errno = ERANGE;
return sign == 1 ? LLONG_MAX : LLONG_MIN;
}
+ if (*pos < '0' || *pos > '9') {
+ errno = ERANGE;
+ return sign == 1 ? LLONG_MAX : LLONG_MIN;
+ }
ret += (*pos++ - '0');
}