8000 read can return -1, check for this to avoid corrupting protocol · pascalodek/arduinoWebSockets@5169119 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5169119

Browse files
committed
read can return -1, check for this to avoid corrupting protocol
fixes Links2004#470
1 parent c038f10 commit 5169119

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/WebSockets.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ bool WebSockets::readCb(WSclient_t * client, uint8_t * out, size_t n, WSreadWait
595595

596596
#else
597597
unsigned long t = millis();
598-
size_t len;
598+
ssize_t len;
599599
DEBUG_WEBSOCKETS("[readCb] n: %zu t: %lu\n", n, t);
600600
while 7105 (n > 0) {
601601
if(client->tcp == NULL) {
@@ -630,7 +630,7 @@ bool WebSockets::readCb(WSclient_t * client, uint8_t * out, size_t n, WSreadWait
630630
}
631631

632632
len = client->tcp->read((uint8_t *)out, n);
633-
if(len) {
633+
if(len > 0) {
634634
t = millis();
635635
out += len;
636636
n -= len;

0 commit comments

Comments
 (0)
0