diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-10-19 15:40:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-19 15:40:41 -0700 |
| commit | c5d8c12e342f8fd904bfdbfb1175860bc03f6416 (patch) | |
| tree | 94f5c89a6837b6ad9da1e2f02f9a393b2497201a | |
| parent | d606a3e968a9b8f38ce951b6d5e63711f2eb3a5b (diff) | |
| parent | 8e6d3e5b91f4c7cdb0dc4743a9a9937708daa624 (diff) | |
Merge pull request #3563 from gamblor21/recv_into_size_check
Add socketpool.socket.recv_into size check
| -rw-r--r-- | locale/circuitpython.pot | 6 | ||||
| -rw-r--r-- | shared-bindings/socketpool/Socket.c | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index cf92b0584..71ef9adca 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-15 16:06+0530\n" +"POT-Creation-Date: 2020-10-16 13:56-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -2107,6 +2107,10 @@ msgstr "" msgid "buffer too small" msgstr "" +#: shared-bindings/socketpool/Socket.c +msgid "buffer too small for requested bytes" +msgstr "" + #: shared-bindings/_pew/PewPew.c msgid "buttons must be digitalio.DigitalInOut" msgstr "" diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index b0af57a5d..e7b31842d 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -257,6 +257,9 @@ STATIC mp_obj_t socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args) mp_int_t len = bufinfo.len; if (n_args == 3) { mp_int_t given_len = mp_obj_get_int(args[2]); + if (given_len > len) { + mp_raise_ValueError(translate("buffer too small for requested bytes")); + } if (given_len > 0 && given_len < len) { len = given_len; } |
