diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-08-14 01:21:32 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-08-14 01:21:32 (GMT) |
commit | c0654d4e60a534b51db8c6e857d4a671237c2463 (patch) | |
tree | 5876a0d664392a3837c5614832f4e860cf254f66 /Modules | |
parent | 7bc44302a0826d68073aefa7522ac7871959e949 (diff) | |
parent | f17a8e9acd6f4b9056f412595ffdbaf8e4c5b7ec (diff) | |
download | cpython-c0654d4e60a534b51db8c6e857d4a671237c2463.zip cpython-c0654d4e60a534b51db8c6e857d4a671237c2463.tar.gz cpython-c0654d4e60a534b51db8c6e857d4a671237c2463.tar.bz2 |
merge 3.5
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_cursesmodule.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index d64bdc7..06aa46c 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -1221,6 +1221,10 @@ PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args) case 1: if (!PyArg_ParseTuple(args,"i;n", &n)) return NULL; + if (n < 0) { + PyErr_SetString(PyExc_ValueError, "'n' must be nonnegative"); + return NULL; + } Py_BEGIN_ALLOW_THREADS rtn2 = wgetnstr(self->win, rtn, Py_MIN(n, 1023)); Py_END_ALLOW_THREADS @@ -1239,6 +1243,10 @@ PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args) case 3: if (!PyArg_ParseTuple(args,"iii;y,x,n", &y, &x, &n)) return NULL; + if (n < 0) { + PyErr_SetString(PyExc_ValueError, "'n' must be nonnegative"); + return NULL; + } #ifdef STRICT_SYSV_CURSES Py_BEGIN_ALLOW_THREADS rtn2 = wmove(self->win,y,x)==ERR ? ERR : |