QXbmHandler: fix missing NUL-termination
The buffer is fed into strstr() on the next loop iteration, but strstr() expects a NUL-terminated string. In the equivalent code some lines up, the buffer is explicitly terminated, and we never write the last character of the buffer again, so we'll not fall off the end of the buffer, but if we read less bytes than in the last line, we'll parse garbage from the previous line. Change-Id: I354e1ce1dea71188942305190500b4778a69b4ff Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
f2205c48c2
commit
083d8caee1
|
|
@ -157,6 +157,7 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage)
|
|||
} else { // read another line
|
||||
if ((readBytes = device->readLine(buf,buflen)) <= 0) // EOF ==> truncated image
|
||||
break;
|
||||
buf[readBytes] = '\0';
|
||||
p = buf + QByteArray::fromRawData(buf, readBytes).indexOf("0x");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue