Skip to content

Commit cdf6b3a

Browse files
committed
Fix UDP write incorrect socket size
1 parent fe82aa7 commit cdf6b3a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Nativesocket.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ uint16_t EthernetClass::socketBufferData(uint8_t s, uint16_t offset, const uint8
354354
{
355355
//Serial.printf(" bufferData, offset=%d, len=%d\n", offset, len);
356356
uint8_t* _buf = (uint8_t*)buf;
357-
if(offset + len >= FNET_SOCKET_DEFAULT_SIZE){
358-
fnet_memcpy(socket_buf_transmit[s] + offset, _buf, FNET_SOCKET_DEFAULT_SIZE - offset);
359-
socket_buf_len[s] += FNET_SOCKET_DEFAULT_SIZE - offset;
360-
return FNET_SOCKET_DEFAULT_SIZE - offset;
357+
if(offset + len >= socket_size){
358+
fnet_memcpy(socket_buf_transmit[s] + offset, _buf, socket_size - offset);
359+
socket_buf_len[s] += socket_size - offset;
360+
return socket_size - offset;
361361
}
362362
else{
363363
fnet_memcpy(socket_buf_transmit[s] + offset, _buf, len);

0 commit comments

Comments
 (0)