diff options
Diffstat (limited to 'libvncclient/sockets.c')
-rw-r--r-- | libvncclient/sockets.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libvncclient/sockets.c b/libvncclient/sockets.c index e50ef0e..c09b555 100644 --- a/libvncclient/sockets.c +++ b/libvncclient/sockets.c @@ -90,6 +90,13 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n) int nn=n; rfbClientLog("ReadFromRFBServer %d bytes\n",n); #endif + + /* Handle attempts to write to NULL out buffer that might occur + when an outside malloc() fails. For instance, memcpy() to NULL + results in undefined behaviour and probably memory corruption.*/ + if(!out) + return FALSE; + if (client->serverPort==-1) { /* vncrec playing */ rfbVNCRec* rec = client->vncRec; |