mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: avoid dereferencing NULL pointer
Coverity CID 208330 Coverity CID 208301 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e8719413a7
commit
6cc5b601aa
1 changed files with 10 additions and 2 deletions
12
core/file.c
12
core/file.c
|
@ -927,6 +927,11 @@ int parse_dan_format(const char *filename, char **params, int pnr)
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!iter) {
|
||||||
|
fprintf(stderr, "DEBUG: Data corrupt");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Setting date */
|
/* Setting date */
|
||||||
memcpy(tmpbuf, iter, 8);
|
memcpy(tmpbuf, iter, 8);
|
||||||
tmpbuf[8] = 0;
|
tmpbuf[8] = 0;
|
||||||
|
@ -950,9 +955,12 @@ int parse_dan_format(const char *filename, char **params, int pnr)
|
||||||
}
|
}
|
||||||
if (ptr)
|
if (ptr)
|
||||||
ptr = strstr(ptr, NL);
|
ptr = strstr(ptr, NL);
|
||||||
if (ptr)
|
if (ptr) {
|
||||||
ptr += strlen(NL);
|
ptr += strlen(NL);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "DEBUG: Data corrupt");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
end_ptr = ptr - (char *)mem.buffer;
|
end_ptr = ptr - (char *)mem.buffer;
|
||||||
|
|
||||||
/* Copy the current dive data to start of mem_csv buffer */
|
/* Copy the current dive data to start of mem_csv buffer */
|
||||||
|
|
Loading…
Add table
Reference in a new issue