projects
/
openwrt
/
staging
/
chunkeey.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
nvram: refuse to open NVRAM for writing if it's too big to be handled
[openwrt/staging/chunkeey.git]
/
package
/
utils
/
nvram
/
src
/
nvram.c
diff --git
a/package/utils/nvram/src/nvram.c
b/package/utils/nvram/src/nvram.c
index f2c79ff7ba73062ba5d955ab16e29c4af5aad1d2..0e1c7268375cc7b1d579820118326b63d3e8d272 100644
(file)
--- a/
package/utils/nvram/src/nvram.c
+++ b/
package/utils/nvram/src/nvram.c
@@
-389,8
+389,8
@@
nvram_handle_t * nvram_open(const char *file, int rdonly)
header = nvram_header(h);
- if
( header->magic == NVRAM_MAGIC )
- {
+ if
(header->magic == NVRAM_MAGIC &&
+
(rdonly || header->len < NVRAM_SPACE))
{
_nvram_rehash(h);
free(mtd);
return h;