Fix legacy text conversion filter for UTF7-IMAP

Make necessary updates to filter state before using CK macro.
This commit is contained in:
Alex Dowad 2022-07-25 07:50:22 +02:00
parent 0a6ea5bd4e
commit 219fff376b

View file

@ -140,16 +140,18 @@ int mbfl_filt_conv_utf7imap_wchar(int c, mbfl_convert_filter *filter)
if (n < 0 || n > 63) {
if (c == '-') {
if (filter->status == 1) { /* "&-" -> "&" */
filter->cache = filter->status = 0;
CK((*filter->output_function)('&', filter->data));
} else if (filter->cache) {
/* Base64-encoded section ended abruptly, with partially encoded characters,
* or it could be that it ended on the first half of a surrogate pair */
filter->cache = filter->status = 0;
CK((*filter->output_function)(MBFL_BAD_INPUT, filter->data));
}
} else { /* illegal character */
filter->cache = filter->status = 0;
CK((*filter->output_function)(MBFL_BAD_INPUT, filter->data));
}
filter->cache = filter->status = 0;
return 0;
}
}