projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
23d2bc4
)
MIPS: BCM47XX: Use strnchr to avoid reading out of the buffer
author
Rafał Miłecki
<
[email protected]
>
Wed, 10 Dec 2014 10:49:54 +0000
(11:49 +0100)
committer
Ralf Baechle
<
[email protected]
>
Wed, 1 Apr 2015 15:21:59 +0000
(17:21 +0200)
Signed-off-by: Rafał Miłecki <
[email protected]
>
Cc: Hauke Mehrtens <
[email protected]
>
Cc: Paul Walmsley <
[email protected]
>
Cc:
[email protected]
Patchwork: https://patchwork.linux-mips.org/patch/8662/
Signed-off-by: Ralf Baechle <
[email protected]
>
arch/mips/bcm47xx/nvram.c
patch
|
blob
|
history
diff --git
a/arch/mips/bcm47xx/nvram.c
b/arch/mips/bcm47xx/nvram.c
index 5e4ae042deb93bac25d374635e370179a662bc81..d805d8af415f58b69ce676491a470498bc47bd1a 100644
(file)
--- 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;