aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-04-07 12:54:23 +0000
committerRafał Miłecki <zajec5@gmail.com>2015-04-07 12:54:23 +0000
commit9f740ddc0ddccb3fcdb5fedca1fb6abe84eee850 (patch)
tree02f7fbb21bc197a6f917b091d84d2b825a54ac05 /target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch
parent3fa00eeda227f7e2f182718509a8a3b8cc163668 (diff)
downloadupstream-9f740ddc0ddccb3fcdb5fedca1fb6abe84eee850.tar.gz
upstream-9f740ddc0ddccb3fcdb5fedca1fb6abe84eee850.tar.bz2
upstream-9f740ddc0ddccb3fcdb5fedca1fb6abe84eee850.zip
brcm47xx: backport MIPS BCM47XX patches queued for 4.1
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 45288
Diffstat (limited to 'target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch')
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch b/target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch
new file mode 100644
index 0000000000..7b16835ae9
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch
@@ -0,0 +1,45 @@
+From 80aaaa8b93d860f828e2cf883f307894640765f0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 10 Dec 2014 11:49:54 +0100
+Subject: [PATCH] MIPS: BCM47XX: Use strnchr to avoid reading out of the buffer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Cc: Paul Walmsley <paul@pwsan.com>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/8662/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/nvram.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
+index 5e4ae04..d805d8a 100644
+--- a/arch/mips/bcm47xx/nvram.c
++++ b/arch/mips/bcm47xx/nvram.c
+@@ -175,7 +175,7 @@ static int nvram_init(void)
+ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
+ {
+ char *var, *value, *end, *eq;
+- int err;
++ int data_left, err;
+
+ if (!name)
+ return -EINVAL;
+@@ -191,7 +191,9 @@ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
+ end = nvram_buf + sizeof(nvram_buf) - 2;
+ end[0] = end[1] = '\0';
+ for (; *var; var = value + strlen(value) + 1) {
+- eq = strchr(var, '=');
++ data_left = end - var;
++
++ eq = strnchr(var, data_left, '=');
+ if (!eq)
+ break;
+ value = eq + 1;
+--
+1.8.4.5
+