diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2018-01-07 08:56:40 +0200 |
---|---|---|
committer | mturkia <miika.turkia@gmail.com> | 2018-01-08 06:06:12 +0200 |
commit | 9d65c5bcddbb01e3f479397010721383df358e98 (patch) | |
tree | c218131d6a80d8472dbf1982669e78aa1350a6dc /core | |
parent | 62d9728ebe624b8dffd6976064f225a4c78762e4 (diff) | |
download | subsurface-9d65c5bcddbb01e3f479397010721383df358e98.tar.gz |
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>
Diffstat (limited to 'core')
-rw-r--r-- | core/import-csv.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/import-csv.c b/core/import-csv.c index 7d46fdb76..3af424315 100644 --- a/core/import-csv.c +++ b/core/import-csv.c @@ -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); |