[ipaccess] The next byte appears to be size...
Using okteta to display the size in bigendian and
then selecting from the start to the " SDP" I get
the same number...
diff --git a/openbsc/src/ipaccess-firmware/ipaccess-firmware.c b/openbsc/src/ipaccess-firmware/ipaccess-firmware.c
index 413f845..e2e5008 100644
--- a/openbsc/src/ipaccess-firmware/ipaccess-firmware.c
+++ b/openbsc/src/ipaccess-firmware/ipaccess-firmware.c
@@ -19,6 +19,7 @@
*
*/
+#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -36,6 +37,7 @@
{
char buf[4096];
int rc;
+ unsigned int absolute_size;
rc = read(fd, buf, 4);
if (rc <= 0) {
@@ -59,7 +61,17 @@
return;
}
+ rc = read(fd, buf, 4);
+ if (rc <= 0) {
+ fprintf(stderr, "Trying to read the header length failed.\n");
+ return;
+ }
+
+ memcpy(&absolute_size, &buf[0], 4);
+ absolute_size = ntohl(absolute_size);
+
printf("Printing header information:\n");
+ printf("The header is %u bytes long\n", absolute_size);
}
int main(int argc, char** argv)