mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-20 10:47:22 -04:00
Properly guard bytes_written against NULL
ws_copyfile() can be called with bytes_copied == NULL but did not check for this condition before using bytes_copied after an IO error, leading to a segfault.
This commit is contained in:
parent
46acba0edb
commit
464bd414a1
@ -2044,7 +2044,10 @@ int ws_copyfile(WS_CONNINFO *pwsc, IOHANDLE hfile, uint64_t *bytes_copied) {
|
|||||||
bytes_written = bytes_read;
|
bytes_written = bytes_read;
|
||||||
if(!io_write(pwsc->hclient,buf,&bytes_written)) {
|
if(!io_write(pwsc->hclient,buf,&bytes_written)) {
|
||||||
ws_dprintf(L_WS_LOG,"Write error: %s\n",io_errstr(pwsc->hclient));
|
ws_dprintf(L_WS_LOG,"Write error: %s\n",io_errstr(pwsc->hclient));
|
||||||
|
|
||||||
|
if (bytes_copied)
|
||||||
*bytes_copied = total_bytes;
|
*bytes_copied = total_bytes;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user