summaryrefslogtreecommitdiff
path: root/shared-bindings/socketpool/Socket.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-09-11 16:17:20 -0700
committerScott Shawcroft <scott@tannewt.org>2020-09-11 16:17:20 -0700
commit8f58669ddddd83fc2820ea8a6689b8d175265783 (patch)
tree50262bcebac31a30ce996cfe0f4a45d454584c59 /shared-bindings/socketpool/Socket.c
parent7611e71a1bc49bcb426e0854519d5143eb262a17 (diff)
Fix bug with socket.recv_into size == 0.
It returned 0 when it should have filled the buffer. Python reference: https://docs.python.org/3/library/socket.html#socket.socket.recv_into
Diffstat (limited to 'shared-bindings/socketpool/Socket.c')
-rw-r--r--shared-bindings/socketpool/Socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c
index 250e9c874..e1b1e6967 100644
--- a/shared-bindings/socketpool/Socket.c
+++ b/shared-bindings/socketpool/Socket.c
@@ -261,7 +261,7 @@ 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) {
+ if (given_len > 0 && given_len < len) {
len = given_len;
}
}