[PATCH 1/2] uemis downloader: avoid NULL pointer dereference
Linus Torvalds
torvalds at linux-foundation.org
Sat Sep 19 21:14:19 PDT 2015
From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Sat, 19 Sep 2015 21:08:03 -0700
Subject: [PATCH 1/2] 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 at linux-foundation.org>
---
uemis-downloader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/uemis-downloader.c b/uemis-downloader.c
index bc3528d72af4..70cc3f78d449 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
--
2.6.0.rc1.16.g1962994
More information about the subsurface
mailing list