Skip to content

Commit 610c14c

Browse files
fixing counter overflow in tcp send
1 parent ee01ce7 commit 610c14c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: libraries/lwIpWrapper/src/lwipClient.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ size_t lwipClient::write(const uint8_t* buffer, size_t size) {
265265
arduino::lock();
266266

267267
uint8_t* buffer_cursor = (uint8_t*)buffer;
268-
uint8_t bytes_to_send = 0;
268+
uint16_t bytes_to_send = 0;
269269

270270
do {
271271
bytes_to_send = min(size - (buffer - buffer_cursor), tcp_sndbuf(this->tcp_info->pcb));
@@ -282,7 +282,7 @@ size_t lwipClient::write(const uint8_t* buffer, size_t size) {
282282
} else if(res == ERR_MEM) {
283283
// FIXME handle this: we get into this case only if the sent data cannot be put in the send queue
284284
}
285-
} while(buffer_cursor < buffer + size);
285+
} while(buffer_cursor - buffer < size);
286286

287287
tcp_output(this->tcp_info->pcb);
288288

0 commit comments

Comments
 (0)