diff options
Diffstat (limited to 'libvncserver')
-rw-r--r-- | libvncserver/main.c | 3 | ||||
-rw-r--r-- | libvncserver/rfbserver.c | 9 |
2 files changed, 6 insertions, 6 deletions
diff --git a/libvncserver/main.c b/libvncserver/main.c index d2dc69f..4e59c98 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -532,7 +532,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, int width,int height,int bitsPerSample,int samplesPerPixel, int bytesPerPixel) { - rfbScreenInfoPtr screen=malloc(sizeof(rfbScreenInfo)); + rfbScreenInfoPtr screen=calloc(sizeof(rfbScreenInfo),1); INIT_MUTEX(logMutex); @@ -759,6 +759,7 @@ void rfbShutdownServer(rfbScreenInfoPtr screen,rfbBool disconnectClients) { if (cl->sock > -1) /* we don't care about maxfd here, because the server goes away */ rfbCloseClient(cl); + rfbReleaseClientIterator(iter); } rfbShutdownSockets(screen); diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index 74f4fbd..7790522 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -413,7 +413,7 @@ rfbClientConnectionGone(cl) if (cl->next) cl->next->prev = cl->prev; - if(cl->sock) + if(cl->sock>0) close(cl->sock); #ifdef LIBVNCSERVER_HAVE_LIBZ @@ -610,6 +610,8 @@ rfbProcessClientInitMessage(cl) return; } + memset(buf,0,256); + si->framebufferWidth = Swap16IfLE(cl->screen->width); si->framebufferHeight = Swap16IfLE(cl->screen->height); si->format = cl->screen->serverFormat; @@ -617,10 +619,7 @@ rfbProcessClientInitMessage(cl) si->format.greenMax = Swap16IfLE(si->format.greenMax); si->format.blueMax = Swap16IfLE(si->format.blueMax); - if (strlen(cl->screen->desktopName) > 128) /* sanity check on desktop name len */ - ((char*)cl->screen->desktopName)[128] = 0; - - strcpy(buf + sz_rfbServerInitMsg, cl->screen->desktopName); + strncpy(buf + sz_rfbServerInitMsg, cl->screen->desktopName, 127); len = strlen(buf + sz_rfbServerInitMsg); si->nameLength = Swap32IfLE(len); |