Skip to content

Commit 82e7142

Browse files
committed
Merge pull request arduino#431 from maxtox/patch-2
When receiving a number of messages, string might include old Data
2 parents a64c8b1 + c58523c commit 82e7142

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libraries/MySensors/core/MyGatewayTransportEthernet.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,13 @@ bool gatewayTransportAvailable()
265265
//debug(PSTR("UDP packet available. Size:%d\n"), packet_size);
266266
#if defined(MY_GATEWAY_ESP8266)
267267
_ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
268+
inputString[0].string[packet_size] = 0;
268269
debug(PSTR("UDP packet received: %s\n"), inputString[0].string);
269270
return protocolParse(_ethernetMsg, inputString[0].string);
270271
#else
271272
_ethernetServer.read(inputString.string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
272273
_w5100_spi_en(false);
274+
inputString.string[packet_size] = 0;
273275
debug(PSTR("UDP packet received: %s\n"), inputString.string);
274276
return protocolParse(_ethernetMsg, inputString.string);
275277
#endif

0 commit comments

Comments
 (0)