From 90147500e0bad40ed39e5c978c523fad7a5f5f9f 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 (cherry picked from commit c3115350eb8bb635d0fdb4dbbb0d0541f38ed19c) --- krdc/vnc/rfbproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krdc/vnc/rfbproto.c b/krdc/vnc/rfbproto.c index c6e05c05..a178ed6f 100644 --- a/krdc/vnc/rfbproto.c +++ b/krdc/vnc/rfbproto.c @@ -987,7 +987,7 @@ HandleRFBServerMessage() /* Regardless of cause, do not divide by zero. */ linesToRead = bytesPerLine ? (BUFFER_SIZE / bytesPerLine) : 0; - while (rect.r.h > 0) { + while (linesToRead && rect.r.h > 0) { if (linesToRead > rect.r.h) linesToRead = rect.r.h;