]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
sws: fix potential OOB write
authorViktor Szakats <commit@vsz.me>
Wed, 18 Mar 2026 18:28:03 +0000 (19:28 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 19 Mar 2026 11:02:10 +0000 (12:02 +0100)
Found by Codex Security

Follow-up to 0aaebf62ec281286afb9e51f2a8088302463df3f

Closes #20988

tests/server/sws.c

index c73a34c6a22b407c7401965fbd45445a2018a00b..cc7adaf0521f00f67514b80736717bb06a3bdd15 100644 (file)
@@ -1127,7 +1127,7 @@ static int sws_get_request(curl_socket_t sock, struct sws_httprequest *req)
       logmsg("wait for websocket traffic");
       do {
         got = sread(sock, reqbuf + req->offset,
-                    sizeof(req->reqbuf) - req->offset);
+                    sizeof(req->reqbuf) - 1 - req->offset);
         if(got > 0) {
           req->offset += got;
           logmsg("Got %zu bytes from client", got);