MQTT client test with W5200 ethernet shield
Dependents: IBMIoTClientEthernetExample_W5200
Fork of W5500Interface by
Diff: Socket/UDPSocket.cpp
- Revision:
- 8:7609a4bd55fd
- Parent:
- 5:8aefaef88f79
diff -r da52bf0e0e5d -r 7609a4bd55fd Socket/UDPSocket.cpp --- a/Socket/UDPSocket.cpp Mon Sep 29 05:03:41 2014 +0000 +++ b/Socket/UDPSocket.cpp Mon Oct 06 01:37:10 2014 +0000 @@ -82,6 +82,12 @@ if (udp_size > (size-sizeof(info))) { return -1; } + /* Perform Length check here to prevent buffer overrun */ + /* fixed by Sean Newton (https://developer.mbed.org/users/SeanNewton/) */ + if (udp_size > length) { + //printf("udp_size: %d\n",udp_size); + return -1; + } return eth->recv(_sock_fd, buffer, udp_size); }