File u_xkb-Check-for-tbGetBuffer-failure.patch of Package xorg-x11-server.5551
Patch-mainline: To be upstreamed
Author: Michal Srb <msrb@suse.com>
Subject: xkb: Check for tbGetBuffer failure.
References: bnc#1051150 CVE-2017-13723
The requested length can be longer than the length of the input string because
of escaping.
---
It can be triggered by a long string containing characters that need escaping.
xkb/xkbtext.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 6dd979409..d77f7c9ed 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -580,6 +580,11 @@ XkbStringText(char *str, unsigned format)
if (ok)
return str;
buf = tbGetBuffer(len + 1);
+ if (!buf) {
+ buf = tbGetBuffer(2);
+ buf[0] = '\0';
+ return buf;
+ }
for (in = str, out = buf; *in != '\0'; in++) {
if (isprint(*in))
*out++ = *in;
--
2.12.3