Fix crash on TERM signal (unintialized memory)

This commit is contained in:
Ron Pedde 2006-07-19 05:55:05 +00:00
parent 1063187b27
commit dd5b5acdac
2 changed files with 11 additions and 8 deletions

View File

@ -171,16 +171,18 @@ void rend_callback(void *info) {
}
src=dst=msg.txt;
while(src && (*src)) {
while(src && (*src) && (src - msg.txt < MAX_TEXT_LEN)) {
len = (*src);
memmove(dst,src+1,len);
dst += len;
src += len + 1;
if(*src) {
*dst++ = '\001';
} else {
*dst='\0';
if((src + len + 1) - msg.txt < MAX_TEXT_LEN) {
memmove(dst,src+1,len);
dst += len;
if(*src) {
*dst++ = '\001';
} else {
*dst='\0';
}
}
src += len + 1;
}
switch(msg.cmd) {

View File

@ -152,6 +152,7 @@ int rend_running(void) {
int rend_stop(void) {
REND_MESSAGE msg;
memset((void*)&msg,0x0,sizeof(msg));
msg.cmd=REND_MSG_TYPE_STOP;
return rend_send_message(&msg);
}