Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save elenril/4089031 to your computer and use it in GitHub Desktop.
Save elenril/4089031 to your computer and use it in GitHub Desktop.
From 55b0f980b53e9407587cb51c72632ae8891e0232 Mon Sep 17 00:00:00 2001
From: Anton Khirnov <anton@khirnov.net>
Date: Fri, 16 Nov 2012 18:01:13 +0100
Subject: [PATCH] FvwmPager: be more careful with window labels.
Do not assume they contain properly encoded strings.
---
modules/FvwmPager/x_pager.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules/FvwmPager/x_pager.c b/modules/FvwmPager/x_pager.c
index a0c3a6f..e56095c 100644
--- a/modules/FvwmPager/x_pager.c
+++ b/modules/FvwmPager/x_pager.c
@@ -2775,6 +2775,11 @@ static void label_window_wrap(PagerWindow *t)
len = FlocaleStringNumberOfBytes(FwindowFont, next);
width = FlocaleTextWidth(FwindowFont, next, len);
+ if (end - next < len) {
+ fprintf(stderr, "%s: malformed window label\n", MyName);
+ return;
+ }
+
if (width > t->pager_view_width - cur_width - 2*label_border && cur != next)
break;
--
1.7.10.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment