1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-06 18:23:12 +02:00

Another URL API fix

This commit is contained in:
Bram Matthys
2026-06-17 20:38:46 +02:00
parent 4966b59812
commit e7459df725
+7 -2
View File
@@ -824,9 +824,14 @@ int https_handle_response_header(Download *handle, char *readbuf, int n)
}
}
if (lastloc)
if (!end_of_request && lastloc)
{
/* Last line was cut somewhere, save it for next round. */
/* Save a cut-off (incomplete) header line for the next packet.
* Only while still reading headers: once end_of_request is set,
* lastloc points at body data that https_handle_response_body()
* already owns via handle->lefttoparse/lefttoparselen, so touching
* it here would desync those two and cause an out-of-bounds read.
*/
safe_strdup(handle->lefttoparse, lastloc);
}