From 9b82dee3a4c93048162db8b643757e817406a37e Mon Sep 17 00:00:00 2001 From: zbierak Date: Tue, 12 Apr 2016 20:23:33 +0200 Subject: Fix buffer overflow when applying client encodings --- libvncclient/rfbproto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index 187a56a..fa46578 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -1492,7 +1492,8 @@ SetFormatAndEncodings(rfbClient* client) if(e->encodings) { int* enc; for(enc = e->encodings; *enc; enc++) - encs[se->nEncodings++] = rfbClientSwap32IfLE(*enc); + if(se->nEncodings < MAX_ENCODINGS) + encs[se->nEncodings++] = rfbClientSwap32IfLE(*enc); } len = sz_rfbSetEncodingsMsg + se->nEncodings * 4; -- cgit v1.2.1