From ed91a6373ccd928ce9e8ab2935bebc157cda7753 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Mon, 29 Dec 2014 16:18:20 +0100 Subject: [PATCH] Verify the file header magic before importing DLF Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- parse-xml.c | 4 ++++ 1 file changed, 4 insertions(+) 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();