Fix UAB in RConsCanvas when resizing

This commit is contained in:
pancake 2022-09-13 01:37:55 +02:00 committed by pancake
parent 14daf84cb1
commit 504c095e89
2 changed files with 5 additions and 1 deletions

View File

@ -1021,7 +1021,8 @@ int PE_(bin_pe_get_actual_checksum)(RBinPEObj* pe) {
return 0;
}
checksum_offset = pe->nt_header_offset + 4 + sizeof (PE_(image_file_header)) + 0x40;
for (i = 0, j = 0; i < pe->size / 4; i++) {
const size_t quarter = pe->size / 4;
for (i = 0, j = 0; i < quarter; i++) {
cur = r_read_at_ble32 (buf, j * 4, pe->endian);
j++;
// skip the checksum bytes

View File

@ -457,6 +457,9 @@ R_API int r_cons_canvas_resize(RConsCanvas *c, int w, int h) {
for (i = 0; i < h; i++) {
if (i < c->h) {
newline = realloc (c->b[i], sizeof (*c->b[i]) * (w + 1));
if (newline) {
c->b[i] = newline;
}
} else {
newline = malloc (w + 1);
}