x11-xserver-utils/debian/patches/04_xrandr-Fix-for-64bit-fee...

30 lines
940 B
Diff

From 3046799a06ecb79211ef0f4a2db9de4eec7233fb Mon Sep 17 00:00:00 2001
From: Egbert Eich <eich@freedesktop.org>
Date: Sun, 3 Aug 2008 13:24:49 +0200
Subject: [PATCH] Fix for 64bit: feed a pointer to the right size variable to scanf().
XID is unsigned long, however %x in scanf takes a pointer to an unsigned int.
Thus with XID xid, a sscanf(..., "0x%x", &xid) will most likely produce the
wrong results.
---
xrandr.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/xrandr.c b/xrandr.c
index 41e15dd..b1e133e 100644
--- a/xrandr/xrandr.c
+++ b/xrandr/xrandr.c
@@ -428,7 +428,8 @@ set_name_all (name_t *name, name_t *old)
static void
set_name (name_t *name, char *string, name_kind_t valid)
{
- XID xid;
+ unsigned int xid; /* don't make it XID (which is unsigned long):
+ scanf() takes unsigned int */
int index;
if ((valid & name_xid) && sscanf (string, "0x%x", &xid) == 1)
--
1.5.6.3