From c3115350eb8bb635d0fdb4dbbb0d0541f38ed19c Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sat, 29 Sep 2018 21:32:59 +0200 Subject: [PATCH] LibVNCClient: fix possible infinite loop Closes #251 --- libvncclient/rfbproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index 808ad4d..8d6a4c1 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -1879,7 +1879,7 @@ HandleRFBServerMessage(rfbClient* client) /* Regardless of cause, do not divide by zero. */ linesToRead = bytesPerLine ? (RFB_BUFFER_SIZE / bytesPerLine) : 0; - while (h > 0) { + while (linesToRead && h > 0) { if (linesToRead > h) linesToRead = h;