Merge pull request #115 from chtisgit/master

Fixed two off-by-one errors in droidvncserver.c
This commit is contained in:
José Pereira 2016-05-21 13:08:10 -07:00
commit ed8d154bae

View File

@ -104,7 +104,7 @@ rfbNewClientHookPtr clientHook(rfbClientPtr cl)
cl->clientGoneHook=(ClientGoneHookPtr)clientGone; cl->clientGoneHook=(ClientGoneHookPtr)clientGone;
char *header="~CONNECTED|"; char *header="~CONNECTED|";
char *msg=malloc(sizeof(char)*((strlen(cl->host)) + strlen(header)+1)); char *msg=malloc(sizeof(char)*((strlen(cl->host)) + strlen(header)+2));
msg[0]='\0'; msg[0]='\0';
strcat(msg,header); strcat(msg,header);
strcat(msg,cl->host); strcat(msg,cl->host);
@ -120,7 +120,7 @@ void CutText(char* str,int len, struct _rfbClientRec* cl)
{ {
str[len]='\0'; str[len]='\0';
char *header="~CLIP|\n"; char *header="~CLIP|\n";
char *msg=malloc(sizeof(char)*(strlen(str) + strlen(header)+1)); char *msg=malloc(sizeof(char)*(strlen(str) + strlen(header)+2));
msg[0]='\0'; msg[0]='\0';
strcat(msg,header); strcat(msg,header);
strcat(msg,str); strcat(msg,str);