summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-12-29 16:18:20 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-29 09:25:13 -0800
commited91a6373ccd928ce9e8ab2935bebc157cda7753 (patch)
tree2354421b0a57b1da5bc2a8f795529c1e913f0139 /parse-xml.c
parenta65816db7d9120cb4548e8277da1e627272fb937 (diff)
downloadsubsurface-ed91a6373ccd928ce9e8ab2935bebc157cda7753.tar.gz
Verify the file header magic before importing DLF
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 739342951..962980059 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -2541,6 +2541,10 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size)
target_table = &dive_table;
+ // Check for the correct file magic
+ if (ptr[0] != 'D' || ptr[1] != 'i' || ptr[2] != 'v' || ptr[3] != 'E')
+ return -1;
+
dive_start();
divecomputer_start();