aboutsummaryrefslogtreecommitdiffstats
path: root/package/libs/libubox/patches/0006-blobmsg-fix-heap-buffer-overflow-in-blobmsg_parse.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2020-01-21 23:58:30 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2020-01-27 21:44:28 +0100
commitcc0a54e3326d6329d85106d93d4083df380dac09 (patch)
tree25a5238aa80d0a2ad920a94e86bd988d775fc48b /package/libs/libubox/patches/0006-blobmsg-fix-heap-buffer-overflow-in-blobmsg_parse.patch
parentebafb746f03e642740159614245e67017734db29 (diff)
downloadupstream-cc0a54e3326d6329d85106d93d4083df380dac09.tar.gz
upstream-cc0a54e3326d6329d85106d93d4083df380dac09.tar.bz2
upstream-cc0a54e3326d6329d85106d93d4083df380dac09.zip
libubox: backport security patches
This backports some security relevant patches from libubox master. These patches should not change the existing API and ABI so that old applications still work like before without any recompilation. Application can now also use more secure APIs. The new more secure interfaces are also available, but not used. OpenWrt master and 19.07 already have these patches by using a more recent libubox version. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'package/libs/libubox/patches/0006-blobmsg-fix-heap-buffer-overflow-in-blobmsg_parse.patch')
-rw-r--r--package/libs/libubox/patches/0006-blobmsg-fix-heap-buffer-overflow-in-blobmsg_parse.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/package/libs/libubox/patches/0006-blobmsg-fix-heap-buffer-overflow-in-blobmsg_parse.patch b/package/libs/libubox/patches/0006-blobmsg-fix-heap-buffer-overflow-in-blobmsg_parse.patch
new file mode 100644
index 0000000000..37be1bb5ad
--- /dev/null
+++ b/package/libs/libubox/patches/0006-blobmsg-fix-heap-buffer-overflow-in-blobmsg_parse.patch
@@ -0,0 +1,32 @@
+From 0773eef13674964d890420673d2501342979d8bf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
+Date: Tue, 10 Dec 2019 12:02:40 +0100
+Subject: blobmsg: fix heap buffer overflow in blobmsg_parse
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes following error found by the fuzzer:
+
+ ==29774==ERROR: AddressSanitizer: heap-buffer-overflow
+ READ of size 1 at 0x6020004f1c56 thread T0
+ #0 strcmp sanitizer_common_interceptors.inc:442:3
+ #1 blobmsg_parse blobmsg.c:168:8
+
+Signed-off-by: Petr Štetiar <ynezz@true.cz>
+---
+ blobmsg.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/blobmsg.c
++++ b/blobmsg.c
+@@ -52,6 +52,9 @@ bool blobmsg_check_attr(const struct blo
+
+ id = blob_id(attr);
+ len = blobmsg_data_len(attr);
++ if (len > blob_raw_len(attr))
++ return false;
++
+ data = blobmsg_data(attr);
+
+ if (id > BLOBMSG_TYPE_LAST)