nvram: fix "Segmentation fault" caused by setting memory out of buffer
authorrmilecki <rmilecki@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 7 Jul 2015 21:21:49 +0000 (21:21 +0000)
committerrmilecki <rmilecki@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 7 Jul 2015 21:21:49 +0000 (21:21 +0000)
commit35c22083e18175e3dc26396df6cf4b54c71384f9
tree3cff6c66a3f0b212240a1b44b507896100ebd38a
parent6e6adcf7a197b1802cb728ddcccf05f890ca0574
nvram: fix "Segmentation fault" caused by setting memory out of buffer

Some MTD partitions with NVRAM have content starting in the middle. In
such case offset is set and nvram_header returns pointer to the middle.
It means we have to respect offset when calculating remaining space.

By the way use real MTD partition size (nvram_part_size variable) as we
may want to bump NVRAM_SPACE in the (very near) future.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46251 3c298f89-4303-0410-b956-a3cf2f4a3e73
package/utils/nvram/src/nvram.c