aboutsummaryrefslogtreecommitdiff
path: root/osc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-04-17 09:25:50 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-04-17 09:25:50 +0000
commit883fc6be27fa43cae7a54ad8099e009f18ee18b8 (patch)
treeaa563dfad841a42bf0da2eb1908678d64885a84e /osc.c
parentmeson: bump version to 1.17.1 (diff)
parentterm: stash last known DPI, and use after a unmapped/mapped sequence (diff)
Merge branch 'master' into releases/1.17
Diffstat (limited to 'osc.c')
-rw-r--r--osc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/osc.c b/osc.c
index 06cc7db6..446461a2 100644
--- a/osc.c
+++ b/osc.c
@@ -524,6 +524,19 @@ osc_notify(struct terminal *term, char *string)
const char *title = strtok_r(string, ";", &ctx);
const char *msg = strtok_r(NULL, "\x00", &ctx);
+ if (title == NULL)
+ return;
+
+ if (mbsntoc32(NULL, title, strlen(title), 0) == (char32_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) {
+ LOG_WARN("%s: notification message is not valid UTF-8, ignoring", msg);
+ return;
+ }
+
notify_notify(term, title, msg != NULL ? msg : "");
}