mirror of
https://github.com/hak5/wifipineapple-openwrt.git
synced 2025-10-29 16:57:19 +00:00
nvram: refuse to open NVRAM for writing if it's too big to be handled
Otherwise writing anything will result in loosing data. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45565 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
41ba634460
commit
41b471d235
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user