[systemd-commits] src/udev

Martin Pitt martin at kemper.freedesktop.org
Mon Nov 4 07:27:40 CET 2013


 src/udev/udev-builtin-keyboard.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b151ca99332f08a6b9909baf94bc5667a589538b
Author: Martin Pitt <martinpitt at gnome.org>
Date:   Mon Nov 4 07:25:45 2013 +0100

    udev-builtin-keyboard: Fix large scan codes on 32 bit architectures
    
    Use strtoul(), as scan codes are always positive. On 32 bit architectures
    strtol gives wrong results:
    
      strtol("fffffff0", &endptr, 16)
    
    returns 2147483647 instead of 4294967280.
    
    https://launchpad.net/bugs/1247676

diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
index ddd8535..8f457ab 100644
--- a/src/udev/udev-builtin-keyboard.c
+++ b/src/udev/udev-builtin-keyboard.c
@@ -88,7 +88,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
                         continue;
 
                 /* KEYBOARD_KEY_<hex scan code>=<key identifier string> */
-                scancode = strtol(key + 13, &endptr, 16);
+                scancode = strtoul(key + 13, &endptr, 16);
                 if (endptr[0] != '\0') {
                         log_error("Error, unable to parse scan code from '%s'\n", key);
                         continue;



More information about the systemd-commits mailing list