mirror of
https://github.com/owntone/owntone-server.git
synced 2025-07-26 17:00:13 -04:00
Fix crash on TERM signal (unintialized memory)
This commit is contained in:
parent
1063187b27
commit
dd5b5acdac
@ -171,17 +171,19 @@ void rend_callback(void *info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
src=dst=msg.txt;
|
src=dst=msg.txt;
|
||||||
while(src && (*src)) {
|
while(src && (*src) && (src - msg.txt < MAX_TEXT_LEN)) {
|
||||||
len = (*src);
|
len = (*src);
|
||||||
|
if((src + len + 1) - msg.txt < MAX_TEXT_LEN) {
|
||||||
memmove(dst,src+1,len);
|
memmove(dst,src+1,len);
|
||||||
dst += len;
|
dst += len;
|
||||||
src += len + 1;
|
|
||||||
if(*src) {
|
if(*src) {
|
||||||
*dst++ = '\001';
|
*dst++ = '\001';
|
||||||
} else {
|
} else {
|
||||||
*dst='\0';
|
*dst='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
src += len + 1;
|
||||||
|
}
|
||||||
|
|
||||||
switch(msg.cmd) {
|
switch(msg.cmd) {
|
||||||
case REND_MSG_TYPE_REGISTER:
|
case REND_MSG_TYPE_REGISTER:
|
||||||
|
@ -152,6 +152,7 @@ int rend_running(void) {
|
|||||||
int rend_stop(void) {
|
int rend_stop(void) {
|
||||||
REND_MESSAGE msg;
|
REND_MESSAGE msg;
|
||||||
|
|
||||||
|
memset((void*)&msg,0x0,sizeof(msg));
|
||||||
msg.cmd=REND_MSG_TYPE_STOP;
|
msg.cmd=REND_MSG_TYPE_STOP;
|
||||||
return rend_send_message(&msg);
|
return rend_send_message(&msg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user