]> git.notmuchmail.org Git - notmuch/blobdiff - lib/thread.cc
lib: Fix potential invalid read past an empty string
[notmuch] / lib / thread.cc
index 45425056034fca555d8c679d670800872813ba13..4c49f980c7b81ee5cb92198d68bf65b8173e8cba 100644 (file)
@@ -251,8 +251,8 @@ _thread_add_message (notmuch_thread_t *thread,
                 term != NULL;
                 term = term->next)
            {
-               /* We ignore initial 'K'. */
-               if (strcmp(tag, (term->string + 1)) == 0) {
+               /* Check for an empty string, and then ignore initial 'K'. */
+               if (*(term->string) && strcmp(tag, (term->string + 1)) == 0) {
                    message_excluded = TRUE;
                    break;
                }