The tag-skipping loop was missing a size>0 guard, so a malformed
DONE command with no space/CR/tab terminator after the tag would
read one byte past the end of the buffer. Also add a \0 check to
stop on embedded null bytes, which are not valid tag characters.
Gbp-Pq: Name 0001-imap-hibernate-Fix-out-of-bounds-read-when-parsing-D.patch
tag_start = data;
/* skip over tag */
- while(data[0] != ' ' &&
+ while(size > 0 &&
+ data[0] != ' ' &&
data[0] != '\r' &&
- data[0] != '\t' ) { data++; size--; }
+ data[0] != '\t' &&
+ data[0] != '\0') { data++; size--; }
tag_end = data;