summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2015-09-19 21:08:03 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-19 21:30:02 -0700
commitad0806406b724b4d0007698e4cca208d90cf650f (patch)
tree5706635baa3d477fef4c18b2027c01bd4fc4a675
parentd2db571b7ab79638355fe3c19c461bb4e87e352e (diff)
downloadsubsurface-ad0806406b724b4d0007698e4cca208d90cf650f.tar.gz
Uemis downloader: avoid NULL pointer dereference
The Uemis downloader blindly just did a strstr on 'nds->name', even if there wasn't necessarily a dive location at all. Add the proper NULL pointer checks. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--uemis-downloader.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/uemis-downloader.c b/uemis-downloader.c
index bc3528d72..70cc3f78d 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -1059,7 +1059,7 @@ static bool load_uemis_divespot(const char *mountpath, int divespot_id)
static void get_uemis_divespot(const char *mountpath, int divespot_id, struct dive *dive)
{
struct dive_site *nds = get_dive_site_by_uuid(dive->dive_site_uuid);
- if (strstr(nds->name,"from Uemis")) {
+ if (nds && nds->name && strstr(nds->name,"from Uemis")) {
if (load_uemis_divespot(mountpath, divespot_id)) {
/* get the divesite based on the diveid, this should give us
* the newly created site