Fix buffer overrun error with some proxy servers
In some cases, depending on the proxy server response, the current implementation of QHttpSocketEngine may write to memory beyond the allocated buffer size. That will trigger undefined behavior on UNIX systems and a buffer overrun exception if compiled with visual studio. Change-Id: I5769d10c56b6a7483d6d94672aa4321287b82651 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
aaaba5da24
commit
553325abfd
@ -568,9 +568,6 @@ void QHttpSocketEngine::slotSocketReadNotification()
|
||||
char dummybuffer[4096];
|
||||
while (d->pendingResponseData) {
|
||||
int read = d->socket->read(dummybuffer, qMin(sizeof(dummybuffer), (size_t)d->pendingResponseData));
|
||||
if (read >= 0)
|
||||
dummybuffer[read] = 0;
|
||||
|
||||
if (read == 0)
|
||||
return;
|
||||
if (read == -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user