Skip to content

Commit

Permalink
Fixed buffer overflow when the netloader chunksize is too large, duri…
Browse files Browse the repository at this point in the history
…ng NRO transfer (this will not occur with an unmodified nxlink).
  • Loading branch information
yellows8 committed Aug 5, 2019
1 parent ce35f40 commit 6c84575
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions common/netloader.c
Expand Up @@ -304,6 +304,12 @@ static int decompress(int sock, FILE *fh, size_t filesize) {
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);

if (strm.avail_in == 0) {
Expand Down

0 comments on commit 6c84575

Please sign in to comment.