The incorrect variable is being used when performing the size check.
This resulted in the wrong calculation and the subsequent invalid read.
if (text->size == 1) {
text->used = text->string[0] ? 1 : 0;
}
- else if (text->used == 2) {
+ else if (text->size == 2) {
if (!text->string[0]) {
text->used = 1;
}
text->used = text->string[1] ? 2 : 1;
}
}
- else if (text->used == 3) {
+ else if (text->size == 3) {
if (!text->string[0]) {
text->used = 1;
}
utf8_print_signal_received(data, status);
status = F_signal;
+
break;
}
}
if (!((++signal_check) % utf8_signal_check_d)) {
if (utf8_signal_received(&data)) {
status = F_status_set_error(F_signal);
+
break;
}