aboutsummaryrefslogtreecommitdiffstats
path: root/package/utils/nvram
diff options
context:
space:
mode:
Diffstat (limited to 'package/utils/nvram')
-rw-r--r--package/utils/nvram/src/nvram.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/package/utils/nvram/src/nvram.c b/package/utils/nvram/src/nvram.c
index f2c79ff7ba..0e1c726837 100644
--- 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;