diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-01-13 23:14:42 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-01-13 23:14:42 -0500 |
commit | c6b37e21f513e056b06013a432be715937a27861 (patch) | |
tree | 66264fd38241846b2d9ed4448e92f854bf450ae5 /Modules/socketmodule.c | |
parent | e74f96ded523fb2fbe977c90093f711ae6bc3d2c (diff) | |
download | cpython-git-c6b37e21f513e056b06013a432be715937a27861.tar.gz |
merge 3.3 (#20246)
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 6c229bcc10..9cc317f5ef 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -2875,6 +2875,11 @@ sock_recvfrom_into(PySocketSockObject *s, PyObject *args, PyObject* kwds) if (recvlen == 0) { /* If nbytes was not specified, use the buffer's length */ recvlen = buflen; + } else if (recvlen > buflen) { + PyBuffer_Release(&pbuf); + PyErr_SetString(PyExc_ValueError, + "nbytes is greater than the length of the buffer"); + return NULL; } readlen = sock_recvfrom_guts(s, buf, recvlen, flags, &addr); |