osc: notify: fix bad check for invalid UTF-8

mbsntoc32() returns (size_t)-1 on failure, not (char32_t)-1.
This commit is contained in:
Daniel Eklöf 2024-08-20 07:14:53 +02:00
parent be13788a4f
commit 7dd204fd31
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

4
osc.c
View file

@ -547,12 +547,12 @@ osc_notify(struct terminal *term, char *string)
if (title == NULL)
return;
if (mbsntoc32(NULL, title, strlen(title), 0) == (char32_t)-1) {
if (mbsntoc32(NULL, title, strlen(title), 0) == (size_t)-1) {
LOG_WARN("%s: notification title is not valid UTF-8, ignoring", title);
return;
}
if (msg != NULL && mbsntoc32(NULL, msg, strlen(msg), 0) == (char32_t)-1) {
if (msg != NULL && mbsntoc32(NULL, msg, strlen(msg), 0) == (size_t)-1) {
LOG_WARN("%s: notification message is not valid UTF-8, ignoring", msg);
return;
}