All current callers are guaranteed to pass input that is NUL-terminated.
In case of SEARCH SENT* commands the input comes from buffer_t, which is also
guaranteed to be NUL-terminated (although not necessarily immediately after the
input data).
Found by naoki-wa via yeswehack.
if (next_token(ctx, &value, &len) <= 0)
return FALSE;
if (len == 3) {
- if (*ctx->parser.data != ',')
+ if (ctx->parser.data == ctx->parser.end ||
+ *ctx->parser.data != ',')
return FALSE;
ctx->parser.data++;
rfc822_skip_lwsp(&ctx->parser);
}
/* :mm (may be the last token) */
- if (!IS_TIME_SEP(*ctx->parser.data))
+ if (ctx->parser.data == ctx->parser.end ||
+ !IS_TIME_SEP(*ctx->parser.data))
return FALSE;
ctx->parser.data++;
rfc822_skip_lwsp(&ctx->parser);