07e07ee
From a2b4ed53679cfccc307a98f34cdbf8a279cd6dae Mon Sep 17 00:00:00 2001
07e07ee
From: Anton Khirnov <anton@khirnov.net>
07e07ee
Date: Fri, 16 Nov 2012 18:01:13 +0100
07e07ee
Subject: [PATCH 5/5] FvwmPager: be more careful with window labels.
07e07ee
07e07ee
Do not assume they contain properly encoded strings.
07e07ee
---
07e07ee
 modules/FvwmPager/x_pager.c | 5 +++++
07e07ee
 1 file changed, 5 insertions(+)
07e07ee
07e07ee
diff --git a/modules/FvwmPager/x_pager.c b/modules/FvwmPager/x_pager.c
07e07ee
index a0c3a6f..e56095c 100644
07e07ee
--- a/modules/FvwmPager/x_pager.c
07e07ee
+++ b/modules/FvwmPager/x_pager.c
07e07ee
@@ -2775,6 +2775,11 @@ static void label_window_wrap(PagerWindow *t)
07e07ee
         len   = FlocaleStringNumberOfBytes(FwindowFont, next);
07e07ee
         width = FlocaleTextWidth(FwindowFont, next, len);
07e07ee
 
07e07ee
+        if (end - next < len) {
07e07ee
+          fprintf(stderr, "%s: malformed window label\n", MyName);
07e07ee
+          return;
07e07ee
+        }
07e07ee
+
07e07ee
         if (width > t->pager_view_width - cur_width - 2*label_border && cur != next)
07e07ee
           break;
07e07ee
 
07e07ee
-- 
07e07ee
1.8.0
07e07ee