openwrt/package/utils/fritz-tools
Daniel Kestrel 12564c5b86 fritz-tools: fix returning wrong values due to strncmp usage
When having two keys that start with the same characters and the second
key just has one character more nand_tffs_read and tffs_read return the
wrong value for the longer key. This is due to the usage of strncmp in
combination with the length of the shorter key which is usually first in
the list before the longer key and when strncmp matches, the search is
stopped. The problem only occurs when the length of the two keys is
different, not if just the last character is different. The fix is to
use strcmp and as such it will only return the value if the key (name)
and the key to look for (namefilter) have the same value and length. A
sample case returning wrong values is when keys macwlan and macwlan2 are
defined and querying macwlan2 returns the value for macwlan.

Signed-off-by: Daniel Kestrel <kestrel1974@t-online.de>
2021-08-08 19:50:46 +02:00
..
src fritz-tools: fix returning wrong values due to strncmp usage 2021-08-08 19:50:46 +02:00
Makefile fritz-tools: add fritz_tffs_nand_read tool 2019-03-10 16:49:23 +01:00
README.md firmware: rework fritz-tools package 2017-04-08 14:30:00 +02:00

Userspace utilties for accessing TFFS (a name-value storage usually found in AVM Fritz!Box based devices)

Building

mkdir build
cd build
cmake /path/to/fritz_tffs_tools
make

Usage

All command line parameters are documented:

fritz_tffs_read -h

Show all entries from a TFFS partition dump (in the format: name=value):

fritz_tffs_read -i /path/to/tffs.dump -a

Read a TFFS partition and show all entries (in the format: name=value):

fritz_tffs_read -i /dev/mtdX -a

Output only the value of a specific key (this will only show the value):

fritz_tffs_read -i /dev/mtdX -n my_ipaddress

LICENSE

See LICENSE:

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.