summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2014-03-12 22:16:14 +0200
committerRoman Yeryomin <roman@advem.lv>2014-03-12 22:16:14 +0200
commite7483918e2eb27e12243f63884aca5e202a7bbbc (patch)
tree7f5b7fc2e21c2353bdbff85b1b43b011dc8997ff
parentf6e4b6dc27888de17437155a9d4b088b63701c9b (diff)
Check uncompressed MIB for correct header too.HEAD0.0.4master
Signed-off-by: Roman Yeryomin <roman@advem.lv>
-rw-r--r--rtkmib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/rtkmib.c b/rtkmib.c
index 067cc9e..71e02fb 100644
--- a/rtkmib.c
+++ b/rtkmib.c
@@ -5,7 +5,7 @@
#include "mibtbl.h"
#define NAME "rtkmib"
-#define VERSION "0.0.3"
+#define VERSION "0.0.4"
uint8_t verbose = 0;
@@ -175,9 +175,12 @@ static int mib_read( char *mtd, unsigned int offset,
sig = header_compr.sig;
len = swap32(header_compr.len);
compression = swap16(header_compr.factor);
- } else {
+ } else if ( !memcmp( MIB_HEADER_TAG, header.sig, MIB_TAG_LEN ) ) {
sig = header.sig;
len = swap16(header.len);
+ } else {
+ printv("Invalid MIB header!\n");
+ return MIB_ERR_GENERIC;
}
printv( "Header info:\n" );