fix segfault bug that could happen in rare fail code path of test5
Thread 1 "xperable" received signal SIGSEGV, Segmentation fault. 0x0814d191 in memcpy ()
This commit is contained in:
parent
9cf3397ef6
commit
0bf7060a96
1 changed files with 5 additions and 3 deletions
|
|
@ -531,9 +531,11 @@ static int test5(struct fbusb *dev, int size, int offset, const char *fname)
|
|||
if (res != FASTBOOT_DATA) {
|
||||
if (*(uint32_t *)rxbuff != 0)
|
||||
return -1;
|
||||
i -= 4;
|
||||
memmove(rxbuff, rxbuff + 4, i);
|
||||
memset(rxbuff + i, 0, 4);
|
||||
if (i > 4) {
|
||||
i -= 4;
|
||||
memmove(rxbuff, rxbuff + 4, i);
|
||||
memset(rxbuff + i, 0, 4);
|
||||
}
|
||||
}
|
||||
size = 0;
|
||||
addr = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue