diff options
author | Guido van Rossum <guido@python.org> | 1998-07-25 04:14:37 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-07-25 04:14:37 (GMT) |
commit | 76310fcc475ce58b3c8495a963519237722e2860 (patch) | |
tree | dfc0e29f622d8cd31bccbb189eac7bc1bb1e19d9 | |
parent | f7685d79e26417e6f7fe0ed337548f58a61950b8 (diff) | |
download | cpython-76310fcc475ce58b3c8495a963519237722e2860.zip cpython-76310fcc475ce58b3c8495a963519237722e2860.tar.gz cpython-76310fcc475ce58b3c8495a963519237722e2860.tar.bz2 |
Make sure that at least one digit has been consumed in atoi().
-rw-r--r-- | Modules/stropmodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c index 2d11851..73a35c9 100644 --- a/Modules/stropmodule.c +++ b/Modules/stropmodule.c @@ -705,6 +705,10 @@ strop_atoi(self, args) x = (long) PyOS_strtoul(s, &end, base); else x = PyOS_strtol(s, &end, base); + if (end == s || !isxdigit(end[-1])) { + PyErr_SetString(PyExc_ValueError, "no digits in int constant"); + return NULL; + } while (*end && isspace(Py_CHARMASK(*end))) end++; if (*end != '\0') { |