mirror of https://github.com/hak5/openwrt.git
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> SVN-Revision: 45565lede-17.01
parent
d94fb398f6
commit
3931288caa
|
@ -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…
Reference in New Issue