Merge pull request #3397 from tannewt/fix_size_0_bug

Fix bug with socket.recv_into size == 0.
This commit is contained in:
Scott Shawcroft 2020-09-14 14:47:28 -07:00 committed by GitHub
commit 3d8bac50e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}
}