Fixed buffer overflow when the netloader chunksize is too large, during NRO transfer (this will not occur with an unmodified nxlink).

This commit is contained in:
yellows8 2019-08-05 12:00:45 -04:00
parent ce35f40f31
commit 6c84575ef7
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43

View File

@ -304,6 +304,12 @@ static int decompress(int sock, FILE *fh, size_t filesize) {
return Z_DATA_ERROR; return Z_DATA_ERROR;
} }
if (chunksize > sizeof(in)) {
(void)inflateEnd(&strm);
netloader_error("Invalid chunk size.",0);
return Z_DATA_ERROR;
}
strm.avail_in = recvall(sock,in,chunksize,0); strm.avail_in = recvall(sock,in,chunksize,0);
if (strm.avail_in == 0) { if (strm.avail_in == 0) {