diff options
| author | Guido van Rossum <guido@python.org> | 1998-07-25 04:14:37 +0000 |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 1998-07-25 04:14:37 +0000 |
| commit | 76310fcc475ce58b3c8495a963519237722e2860 (patch) | |
| tree | dfc0e29f622d8cd31bccbb189eac7bc1bb1e19d9 /Modules/stropmodule.c | |
| parent | f7685d79e26417e6f7fe0ed337548f58a61950b8 (diff) | |
| download | cpython-git-76310fcc475ce58b3c8495a963519237722e2860.tar.gz | |
Make sure that at least one digit has been consumed in atoi().
Diffstat (limited to 'Modules/stropmodule.c')
| -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 2d11851e7c..73a35c9b5c 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') { |
