Author: rmilecki
Date: 2015-04-14 14:18:57 +0200 (Tue, 14 Apr 2015)
New Revision: 45433

Modified:
   trunk/package/utils/otrx/src/otrx.c
Log:
otrx: check TRX length read from header to avoid Segmentation fault

Signed-off-by: Rafa?\197?\130 Mi?\197?\130ecki <[email protected]>

Modified: trunk/package/utils/otrx/src/otrx.c
===================================================================
--- trunk/package/utils/otrx/src/otrx.c 2015-04-14 12:17:34 UTC (rev 45432)
+++ trunk/package/utils/otrx/src/otrx.c 2015-04-14 12:18:57 UTC (rev 45433)
@@ -167,6 +167,12 @@
        }
 
        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);
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to