projects
/
openwrt
/
staging
/
dangole.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d94fb39
)
nvram: refuse to open NVRAM for writing if it's too big to be handled
author
Rafał Miłecki
<zajec5@gmail.com>
Wed, 22 Apr 2015 19:07:19 +0000
(19:07 +0000)
committer
Rafał Miłecki
<zajec5@gmail.com>
Wed, 22 Apr 2015 19:07:19 +0000
(19:07 +0000)
Otherwise writing anything will result in loosing data.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
SVN-Revision: 45565
package/utils/nvram/src/nvram.c
patch
|
blob
|
history
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;