-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
I think, I found a bug in adafruit_wiznet5k/adafruit_wiznet5k.py
line 724, the code already has ret variable (SOCK_SIZE check & len of buffer)
Adafruit_CircuitPython_Wiznet5k/adafruit_wiznet5k/adafruit_wiznet5k.py
Lines 724 to 727 in f00a3f7
| if len(buffer) > SOCK_SIZE: | |
| ret = SOCK_SIZE | |
| else: | |
| ret = len(buffer) |
But, line 747, 751, didn't use this ret variable.
Adafruit_CircuitPython_Wiznet5k/adafruit_wiznet5k/adafruit_wiznet5k.py
Lines 747 to 751 in f00a3f7
| ptr = (ptr + len(buffer)) & 0xFFFF | |
| self._write_sntx_wr(socket_num, ptr) | |
| cntl_byte = 0x14 + (socket_num << 5) | |
| self.write(dst_addr, cntl_byte, buffer) |
Need to fix? My suggestion is:
# update sn_tx_wr to the value + data size
ptr = (ptr + ret) & 0xFFFF # <-- use ret
self._write_sntx_wr(socket_num, ptr)
cntl_byte = 0x14 + (socket_num << 5)
txbuf = buffer[:ret] # <- use ret
self.write(dst_addr, cntl_byte, txbuf) # <- use txbuf
Metadata
Metadata
Assignees
Labels
No labels