aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSander Vanheule <sander@svanheule.net>2020-07-11 22:58:07 +0200
committerStijn Tintel <stijn@linux-ipv6.be>2020-09-09 20:41:50 +0300
commit6985a26e5999c2d090d0ab57e19fba490b888ced (patch)
tree079b5b67efa20e6f341012e13fd1b10c43bd0fc0 /tools
parentb71668f96abf3ba6b717f46028567944eb2fef77 (diff)
downloadupstream-6985a26e5999c2d090d0ab57e19fba490b888ced.tar.gz
upstream-6985a26e5999c2d090d0ab57e19fba490b888ced.tar.bz2
upstream-6985a26e5999c2d090d0ab57e19fba490b888ced.zip
firmware-utils/tplink-safeloader: soft-version magic is data length
The soft-version partition actually contains a header and trailing data: * header: {data length, [zero]} * data: {version, bcd encoded date, revision} The data length is currently treated as a magic number, but should contain the length of the partition data. This header is also present the following partitions (non-exhaustive): * string-based soft-version * support-list Signed-off-by: Sander Vanheule <sander@svanheule.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/firmware-utils/src/tplink-safeloader.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 501b396343..145e80855a 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -84,7 +84,7 @@ struct device_info {
/** The content of the soft-version structure */
struct __attribute__((__packed__)) soft_version {
- uint32_t magic;
+ uint32_t data_len;
uint32_t zero;
uint8_t pad1;
uint8_t version_major;
@@ -2153,7 +2153,8 @@ static struct image_partition_entry make_soft_version(uint32_t rev) {
struct tm *tm = gmtime(&t);
- s->magic = htonl(0x0000000c);
+ /* Partition contents size, minus 8 byte header and trailing byte */
+ s->data_len = htonl(entry.size-9);
s->zero = 0;
s->pad1 = 0xff;