mirror of
https://github.com/hak5/wifipineapple-openwrt.git
synced 2025-10-29 16:57:19 +00:00
otrx: check TRX length read from header to avoid Segmentation fault
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45433 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -167,6 +167,12 @@ static int otrx_check() {
|
||||
}
|
||||
|
||||
length = le32_to_cpu(hdr.length);
|
||||
if (length < sizeof(hdr)) {
|
||||
fprintf(stderr, "Length read from TRX too low (%zu B)\n", length);
|
||||
err = -EINVAL;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
buf = malloc(length);
|
||||
if (!buf) {
|
||||
fprintf(stderr, "Couldn't alloc %d B buffer\n", length);
|
||||
|
||||
Reference in New Issue
Block a user