Commit f5d21bec authored by rswindell's avatar rswindell
Browse files

Correctly detect invalid UTF-8 sequences and log rather than print the

notice.
parent 73e890cd
......@@ -256,8 +256,8 @@ size_t sbbs_t::utf8_to_cp437(const char* str, size_t len)
}
uint32_t codepoint = 0;
len = utf8_getc(str, len, &codepoint);
if(len < 2) {
bprintf("Invalid UTF-8 sequence: %02X (error = %d)", (uchar)*str, (int)len);
if((int)len < 2) {
lprintf(LOG_NOTICE, "Invalid UTF-8 sequence: %02X (error = %d)", (uchar)*str, (int)len);
return 1;
}
for(int i = 1; i < 0x100; i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment