notmuch: fix buffer overflow, improve tag_list usage