Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f1f8d7e

Browse filesBrowse files
Schuemime-no-dev
authored andcommitted
Packet with zero data length (espressif#1659)
If you receive a package with a data length of zero, parsePacket returns 0, but rx_buffer will exist. So if another parsePacket with no read access returns to zeros, there is still data that can be read. This example would not work: https://www.arduino.cc/en/Reference/EthernetUDPParsePacket Also I added a check if rx_buffer exit when you try to flush it.
1 parent da798c7 commit f1f8d7e
Copy full SHA for f1f8d7e

File tree

1 file changed

+2
-0
lines changed
Filter options

1 file changed

+2
-0
lines changed

‎libraries/WiFi/src/WiFiUdp.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiUdp.cpp
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ int WiFiUDP::parsePacket(){
221221
}
222222
remote_ip = IPAddress(si_other.sin_addr.s_addr);
223223
remote_port = ntohs(si_other.sin_port);
224+
if (len == 0) return 0;
224225
rx_buffer = new cbuf(len);
225226
rx_buffer->write(buf, len);
226227
delete[] buf;
@@ -264,6 +265,7 @@ int WiFiUDP::peek(){
264265
}
265266

266267
void WiFiUDP::flush(){
268+
if(!rx_buffer) return;
267269
cbuf *b = rx_buffer;
268270
rx_buffer = 0;
269271
delete b;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.