[ipaccess] Attempt to read the header entries..

This commit is contained in:
Holger Hans Peter Freyther 2009-12-29 06:01:36 +01:00
parent 46a920c36c
commit 567b3261d9
1 changed files with 13 additions and 0 deletions

View File

@ -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)