lib: Fix potential invalid read past an empty string
authorTodd <todd@electricoding.com>
Sat, 17 Jan 2015 15:51:45 +0000 (09:51 -0600)
committerDavid Bremner <david@tethera.net>
Mon, 19 Jan 2015 07:15:05 +0000 (08:15 +0100)
commit0fc788460276f0e08c3ccae0a779f96125624a8d
treea6f3399e98474678814716ae984db7472e6f138a
parent2a0a13a433e24076453da38f18d7d6053af34287
lib: Fix potential invalid read past an empty string

==22884== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x601600008291 at pc 0x7ff6295680e5 bp 0x7fff4ab9aa40 sp 0x7fff4ab9aa08
READ of size 1 at 0x601600008291 thread T0
    #0 0x7ff6295680e4 in __interceptor_strcmp ??:?
    #1 0x44763b in _thread_add_message /home/todd/.apps/notmuch/lib/thread.cc:255
    #2 0x4459e8 in notmuch_threads_get /home/todd/.apps/notmuch/lib/query.cc:496
    #3 0x41e2a7 in do_search_threads /home/todd/.apps/notmuch/notmuch-search.c:131
    #4 0x40a408 in main /home/todd/.apps/notmuch/notmuch.c:345
    #5 0x7ff627cb9ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287
    #6 0x40abf3 in _start ??:?
0x601600008291 is located 0 bytes to the right of 97-byte region [0x601600008230,0x601600008291)
allocated by thread T0 here:
    #0 0x7ff62956e41a in malloc ??:?
    #1 0x7ff628b8ab5d in talloc_strdup ??:?
lib/thread.cc