[PATCH libX11 2/4] XStringToKeysym: Special case for XF86 keysyms
Daniel Stone
daniel at fooishbar.org
Thu Jul 8 08:50:48 PDT 2010
On Thu, Jul 08, 2010 at 08:45:45AM -0700, Keith Packard wrote:
> On Thu, 8 Jul 2010 15:00:33 +0100, Daniel Stone <daniel at fooishbar.org> wrote:
>
> > + if (strncmp(s, "XF86_", 5) == 0) {
> > + KeySym ret;
> > + char *tmp = strdup(s);
>
> Please check malloc returns in Xlib...
>
> Otherwise,
>
> Reviewed-by: Keith Packard <keithp at keithp.com>
Jesus, how embarassment. Is the following OK?
Cheers,
Daniel
From ee7708ddf8f3f7025ded7d5e60855826e7c2bb16 Mon Sep 17 00:00:00 2001
From: Daniel Stone <daniel at fooishbar.org>
Date: Thu, 8 Jul 2010 16:49:51 +0100
Subject: [PATCH] XStringToKeysym: Check strdup() return value
Signed-off-by: Daniel Stone <daniel at fooishbar.org>
Reviewed-by: Keith Packard <keithp at keithp.com>
---
src/StrKeysym.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/StrKeysym.c b/src/StrKeysym.c
index f502de1..4bed94b 100644
--- a/src/StrKeysym.c
+++ b/src/StrKeysym.c
@@ -159,6 +159,8 @@ XStringToKeysym(_Xconst char *s)
if (strncmp(s, "XF86_", 5) == 0) {
KeySym ret;
char *tmp = strdup(s);
+ if (!tmp)
+ return NoSymbol;
memmove(&tmp[4], &tmp[5], strlen(s) - 5 + 1);
ret = XStringToKeysym(tmp);
free(tmp);
--
1.7.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100708/9abb95f8/attachment.pgp>
More information about the xorg-devel
mailing list