X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmessage-file.c;fp=lib%2Fmessage-file.c;h=15b0bfad2e63772c314f4545eb0a3ffa19a15b2c;hb=8aeba1228ace947c1b689ae6ae08db5d53755917;hp=311bd478b0cfff13620ba653795ccb9cd62246bf;hpb=97fadd0645e908ff8322577a983dc710bfda33d6;p=notmuch diff --git a/lib/message-file.c b/lib/message-file.c index 311bd478..15b0bfad 100644 --- a/lib/message-file.c +++ b/lib/message-file.c @@ -65,11 +65,12 @@ _notmuch_message_file_open_ctx (notmuch_database_t *notmuch, return NULL; const char *prefix = notmuch_database_get_path (notmuch); + if (prefix == NULL) goto FAIL; if (*filename == '/') { - if (strncmp (filename, prefix, strlen(prefix)) != 0) { + if (strncmp (filename, prefix, strlen (prefix)) != 0) { _notmuch_database_log (notmuch, "Error opening %s: path outside mail root\n", filename); errno = 0; @@ -77,7 +78,7 @@ _notmuch_message_file_open_ctx (notmuch_database_t *notmuch, } message->filename = talloc_strdup (message, filename); } else { - message->filename = talloc_asprintf(message, "%s/%s", prefix, filename); + message->filename = talloc_asprintf (message, "%s/%s", prefix, filename); } if (message->filename == NULL)