[PATCH] mail-storage.c: check against NULL address in strcmp() invocation
Michal Soltys
soltys at ziu.info
Tue Jan 10 19:58:03 UTC 2017
Configurations with multiple shared namespaces can trigger a bug
where the first argument of strcmp() invocation is NULL.
This patch adds an explicit check, analogously to how the second
argument is sanitized.
---
src/lib-storage/mail-storage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c
index 1d9b1bf..3d9f5dc 100644
--- a/src/lib-storage/mail-storage.c
+++ b/src/lib-storage/mail-storage.c
@@ -282,7 +282,7 @@ mail_storage_match_class(struct mail_storage *storage,
return FALSE;
if ((storage->class_flags & MAIL_STORAGE_CLASS_FLAG_UNIQUE_ROOT) != 0 &&
- strcmp(storage->unique_root_dir,
+ strcmp((storage->unique_root_dir != NULL ? storage->unique_root_dir : ""),
(set->root_dir != NULL ? set->root_dir : "")) != 0)
return FALSE;
--
2.1.3
More information about the dovecot
mailing list