Stricter check we get dive profile

We should get either dive trailer or dive profile immediately after
header. Thus make sure that is the case.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2018-01-07 08:56:40 +02:00 committed by mturkia
parent 62d9728ebe
commit 9d65c5bcdd

View file

@ -140,7 +140,13 @@ int parse_dan_format(const char *filename, char **params, int pnr)
continue;
}
ptr = strstr(ptr, "ZDP{");
/* After ZDH we should get either ZDT (above) or ZDP */
if (strncmp(iter, "ZDP{", 4) != 0) {
fprintf(stderr, "DEBUG: Input appears to violate DL7 specification\n");
end_ptr = iter - (char *)mem.buffer;
continue;
}
if (ptr && ptr[4] == '}') {
end_ptr += ptr - (char *)mem_csv.buffer;
return report_error(translate("gettextFromC", "No dive profile found from '%s'"), filename);