mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Fix UAB in RConsCanvas when resizing
This commit is contained in:
parent
14daf84cb1
commit
504c095e89
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user