Replace a LOT of sprintf with snprintf, and a few strcpy with truncate_cpy

This commit is contained in:
Henrik Rydgård
2023-04-28 21:04:05 +02:00
parent c02634c161
commit 6945deec01
39 changed files with 170 additions and 193 deletions

View File

@@ -191,7 +191,7 @@ static void DiscHandler(const http::Request &request, const Path &filename) {
s64 len = last - begin + 1;
char contentRange[1024];
sprintf(contentRange, "Content-Range: bytes %lld-%lld/%lld\r\n", begin, last, sz);
snprintf(contentRange, sizeof(contentRange), "Content-Range: bytes %lld-%lld/%lld\r\n", begin, last, sz);
request.WriteHttpResponseHeader("1.0", 206, len, "application/octet-stream", contentRange);
const size_t CHUNK_SIZE = 16 * 1024;