summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-02-01 13:45:07 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-01 07:06:12 -0800
commit2dc1a42b297eb49850767e71a644e5efc349b0c9 (patch)
treeab7cb7224edba1f967da8d1f76976e5d8837021f /file.c
parent1e45858ee6e40da932be301e39d3fced6b393490 (diff)
downloadsubsurface-2dc1a42b297eb49850767e71a644e5efc349b0c9.tar.gz
Fix crash if one selects incorrectly Seabear CSV
Fixes #814 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r--file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/file.c b/file.c
index eacd8756a..e03edaf82 100644
--- a/file.c
+++ b/file.c
@@ -932,6 +932,13 @@ int parse_seabear_csv_file(const char *filename, int timef, int depthf, int temp
NL = "\r\n";
}
+ /*
+ * If file does not contain empty lines, it is not a valid
+ * Seabear CSV file.
+ */
+ if (!ptr)
+ return -1;
+
if (!ptr_old) {
while ((ptr = strstr(ptr, "\n\n")) != NULL) {
ptr_old = ptr;