diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-29 06:01:36 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-29 08:38:12 +0100 |
commit | 567b3261d9fb10aba13850a9ee7f18dd9b15bc93 (patch) | |
tree | 42c8a7dafd1827edf1725a990ab6c72d0a40cc6f /openbsc/src/ipaccess/ipaccess-firmware.c | |
parent | 46a920c36ce90f3ab5443ffb02aa1b4503a75d5f (diff) |
[ipaccess] Attempt to read the header entries..
Diffstat (limited to 'openbsc/src/ipaccess/ipaccess-firmware.c')
-rw-r--r-- | openbsc/src/ipaccess/ipaccess-firmware.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/openbsc/src/ipaccess/ipaccess-firmware.c b/openbsc/src/ipaccess/ipaccess-firmware.c index 5cf99d428..5df3a3864 100644 --- a/openbsc/src/ipaccess/ipaccess-firmware.c +++ b/openbsc/src/ipaccess/ipaccess-firmware.c @@ -19,6 +19,8 @@ * */ +#include <openbsc/debug.h> + #include <arpa/inet.h> #include <sys/types.h> #include <sys/stat.h> @@ -41,6 +43,12 @@ struct sdp_firmware { /* stuff i don't know */ } __attribute__((packed)); +struct sdp_header_entry { + u_int8_t entry[138]; +} __attribute__((packed)); + +static_assert(sizeof(struct sdp_header_entry) == 138, right_entry); + /* more magic, the second "int" in the header */ static char more_magic[] = { 0x10, 0x02, 0x00, 0x0 }; @@ -87,6 +95,11 @@ static void analyze_file(int fd) fprintf(stderr, "The filesize and the header do not match.\n"); return; } + + if (ntohs(firmware_header->part_length) % PART_LENGTH != 0) { + fprintf(stderr, "The part length seems to be wrong.\n"); + return; + } } int main(int argc, char** argv) |