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>
This commit is contained in:
Anton Lundin 2014-12-29 16:18:20 +01:00 committed by Dirk Hohndel
parent a65816db7d
commit ed91a6373c

View file

@ -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();