break;
}
}
- if (i == size || data[i+1] != '=') {
+ if (i+1 >= size || data[i+1] != '=') {
/* invalid block */
return 0;
}
}
if (size != start_pos) {
+ i_assert(size > start_pos);
(void)callback(data + start_pos, size - start_pos,
NULL, context);
}
test_end();
}
+static void test_message_header_decode_read_overflow(void)
+{
+ const unsigned char input[] = "=?utf-8?Q?=EF?=";
+ string_t *dest = t_str_new(32);
+
+ test_begin("message header decode read overflow");
+ message_header_decode_utf8(input, sizeof(input)-2, dest, NULL);
+ test_end();
+}
+
static void test_message_header_decode_encode_random(void)
{
string_t *encoded, *decoded;
{
static void (*test_functions[])(void) = {
test_message_header_decode,
+ test_message_header_decode_read_overflow,
test_message_header_decode_encode_random,
NULL
};