The trailing timezone check used msg != msg_end before reading
msg[0] through msg[5]. When fewer than 6 bytes remain, this
reads past the buffer. Replace with msg + 6 <= msg_end.
Found by fuzzing with libFuzzer and AddressSanitizer.
Signed-off-by: Mark Esler <mark@hexproof.dev>
}
tm.tm_isdst = -1;
- if (!seen_timezone && msg != msg_end &&
+ if (!seen_timezone && msg + 6 <= msg_end &&
msg[0] == ' ' && (msg[1] == '-' || msg[1] == '+') &&
i_isdigit(msg[2]) && i_isdigit(msg[3]) &&
i_isdigit(msg[4]) && i_isdigit(msg[5])) {