[Xquartz-changes] xserver: Branch 'master'
Jeremy Huddleston
jeremyhu at freedesktop.org
Tue Jun 8 13:03:01 PDT 2010
hw/xquartz/quartzKeyboard.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
New commits:
commit 5e1ef1f4dde4615498c1c5e7a4e422c3b3432fe8
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Tue Jun 8 13:01:10 2010 -0700
XQuartz: Add more sanity checking around string manipulation for xmodmap
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 745333f..75cf23f 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -427,20 +427,28 @@ void DarwinKeyboardReloadHandler(void) {
}
} pthread_mutex_unlock(&keyInfo_mutex);
- /* Check for system .Xmodmap */
+ /* Modify with xmodmap */
if (access(xmodmap, F_OK) == 0) {
+ /* Check for system .Xmodmap */
if (access(sysmodmap, F_OK) == 0) {
- snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, sysmodmap);
- X11ApplicationLaunchClient(cmd);
+ if(snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, sysmodmap) < sizeof(cmd)) {
+ X11ApplicationLaunchClient(cmd);
+ } else {
+ ErrorF("X11.app: Unable to create / execute xmodmap command line");
+ }
}
- }
-
- /* Check for user's local .Xmodmap */
- if (homedir != NULL) {
- snprintf (usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir);
- if (access(usermodmap, F_OK) == 0) {
- snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, usermodmap);
- X11ApplicationLaunchClient(cmd);
+
+ /* Check for user's local .Xmodmap */
+ if ((homedir != NULL) && (snprintf (usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir) < sizeof(usermodmap))) {
+ if (access(usermodmap, F_OK) == 0) {
+ if(snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, usermodmap) < sizeof(cmd)) {
+ X11ApplicationLaunchClient(cmd);
+ } else {
+ ErrorF("X11.app: Unable to create / execute xmodmap command line");
+ }
+ }
+ } else {
+ ErrorF("X11.app: Unable to determine path to user's .Xmodmap");
}
}
}
More information about the Xquartz-changes
mailing list