diff options
author | Christian Beier <[email protected]> | 2018-09-29 20:55:24 +0200 |
---|---|---|
committer | Christian Beier <[email protected]> | 2018-09-29 20:55:24 +0200 |
commit | 8b06f835e259652b0ff026898014fc7297ade858 (patch) | |
tree | 2b5d584451461f43152ef28cccdc0a9ed22c528e /libvncclient | |
parent | 5f3ea4e53d3a756864de4f6ceb6ab8068afff3c5 (diff) | |
download | libtdevnc-8b06f835e259652b0ff026898014fc7297ade858.tar.gz libtdevnc-8b06f835e259652b0ff026898014fc7297ade858.zip |
When connecting to a repeater, only send initialised string
Closes #253
Diffstat (limited to 'libvncclient')
-rw-r--r-- | libvncclient/rfbproto.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index e5373bc..669e388 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -363,6 +363,7 @@ rfbBool ConnectToRFBRepeater(rfbClient* client,const char *repeaterHost, int rep rfbProtocolVersionMsg pv; int major,minor; char tmphost[250]; + int tmphostlen; #ifdef LIBVNCSERVER_IPv6 client->sock = ConnectClientToTcpAddr6(repeaterHost, repeaterPort); @@ -398,8 +399,11 @@ rfbBool ConnectToRFBRepeater(rfbClient* client,const char *repeaterHost, int rep rfbClientLog("Connected to VNC repeater, using protocol version %d.%d\n", major, minor); - snprintf(tmphost, sizeof(tmphost), "%s:%d", destHost, destPort); - if (!WriteToRFBServer(client, tmphost, sizeof(tmphost))) + tmphostlen = snprintf(tmphost, sizeof(tmphost), "%s:%d", destHost, destPort); + if(tmphostlen < 0 || tmphostlen >= (int)sizeof(tmphost)) + return FALSE; /* snprintf error or output truncated */ + + if (!WriteToRFBServer(client, tmphost, tmphostlen + 1)) return FALSE; return TRUE; |