summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordscho <johannes.schindelin@gmx.de>2014-08-26 16:43:44 +0200
committerdscho <johannes.schindelin@gmx.de>2014-08-26 16:43:44 +0200
commit50dbe1df75d983cf7d69874383445fdff18de5a3 (patch)
tree359ac608feab381bd58953717521d1c98e87a2df
parent7c9ef6372d3ce2942fe78e853c611e269f68eb69 (diff)
parent05a9bd41a8ec0a9d580a8f420f41718bdd235446 (diff)
downloadlibvncserver-50dbe1df75d983cf7d69874383445fdff18de5a3.zip
libvncserver-50dbe1df75d983cf7d69874383445fdff18de5a3.tar.gz
Merge pull request #21 from newsoft/master
Fixing two more security issues (remote server crash)
-rw-r--r--libvncserver/rfbserver.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c
index 5f3b31d..df7d74c 100644
--- a/libvncserver/rfbserver.c
+++ b/libvncserver/rfbserver.c
@@ -2461,6 +2461,11 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
msg.cct.length = Swap32IfLE(msg.cct.length);
str = (char *)malloc(msg.cct.length);
+ if (str == NULL) {
+ rfbLogPerror("rfbProcessClientNormalMessage: not enough memory");
+ rfbCloseClient(cl);
+ return;
+ }
if ((n = rfbReadExact(cl, str, msg.cct.length)) <= 0) {
if (n != 0)
@@ -2486,6 +2491,13 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
rfbCloseClient(cl);
return;
}
+
+ if (msg.ssc.scale == 0) {
+ rfbLogPerror("rfbProcessClientNormalMessage: will not accept a scale factor of zero");
+ rfbCloseClient(cl);
+ return;
+ }
+
rfbStatRecordMessageRcvd(cl, msg.type, sz_rfbSetScaleMsg, sz_rfbSetScaleMsg);
rfbLog("rfbSetScale(%d)\n", msg.ssc.scale);
rfbScalingSetup(cl,cl->screen->width/msg.ssc.scale, cl->screen->height/msg.ssc.scale);
@@ -2502,6 +2514,13 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
rfbCloseClient(cl);
return;
}
+
+ if (msg.ssc.scale == 0) {
+ rfbLogPerror("rfbProcessClientNormalMessage: will not accept a scale factor of zero");
+ rfbCloseClient(cl);
+ return;
+ }
+
rfbStatRecordMessageRcvd(cl, msg.type, sz_rfbSetScaleMsg, sz_rfbSetScaleMsg);
rfbLog("rfbSetScale(%d)\n", msg.ssc.scale);
rfbScalingSetup(cl,cl->screen->width/msg.ssc.scale, cl->screen->height/msg.ssc.scale);
OpenPOWER on IntegriCloud