mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 00:05:03 -05: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;
|
||||
if(!io_write(pwsc->hclient,buf,&bytes_written)) {
|
||||
ws_dprintf(L_WS_LOG,"Write error: %s\n",io_errstr(pwsc->hclient));
|
||||
*bytes_copied = total_bytes;
|
||||
|
||||
if (bytes_copied)
|
||||
*bytes_copied = total_bytes;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user