From f72c982c896c35ad71d366a06684229c04e3ed54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 9 Jun 2020 17:33:26 +0200 Subject: [PATCH] osc: don't assert on \E]4 being followed by a ';' This fixes a crash (in debug builds) that could be triggered by e.g. cat:ing /dev/urandom. --- CHANGELOG.md | 2 ++ osc.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d11caa1b..4f91a08d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,8 @@ * Sixel images being erased when printing text next to them. * Crash when last rendered cursor cell had scrolled off screen and `\E[J3` was executed. +* Assert (debug builds) when an `\e]4` OSC escape was not followed by + a `;`. ### Security diff --git a/osc.c b/osc.c index d28fd057..42f775b4 100644 --- a/osc.c +++ b/osc.c @@ -431,6 +431,9 @@ osc_dispatch(struct terminal *term) /* Set color */ string--; + if (*string != ';') + break; + assert(*string == ';'); for (const char *s_idx = strtok(string, ";"), *s_color = strtok(NULL, ";");