[ipaccess] The second four bytes appear to be always the same
diff --git a/openbsc/src/ipaccess-firmware/ipaccess-firmware.c b/openbsc/src/ipaccess-firmware/ipaccess-firmware.c
index 0f93629..413f845 100644
--- a/openbsc/src/ipaccess-firmware/ipaccess-firmware.c
+++ b/openbsc/src/ipaccess-firmware/ipaccess-firmware.c
@@ -28,6 +28,9 @@
#include <string.h>
+/* more magic, the second "int" in the header */
+static char more_magic[] = { 0x10, 0x02, 0x00, 0x0 };
+
static void analyze_file(int fd)
{
@@ -45,6 +48,17 @@
return;
}
+ rc = read(fd, buf, 4);
+ if (rc <= 0) {
+ fprintf(stderr, "Not enough space for the more_magic.\n");
+ return;
+ }
+
+ if (strncmp(buf, more_magic, 4) != 0) {
+ fprintf(stderr, "The more magic is not right.\n");
+ return;
+ }
+
printf("Printing header information:\n");
}