[arch-commits] Commit in libxi/repos (6 files)

Laurent Carlier lcarlier at archlinux.org
Thu Oct 13 16:37:19 UTC 2016


    Date: Thursday, October 13, 2016 @ 16:37:19
  Author: lcarlier
Revision: 278797

archrelease: copy trunk to testing-i686, testing-x86_64

Added:
  libxi/repos/testing-i686/
  libxi/repos/testing-i686/PKGBUILD
    (from rev 278796, libxi/trunk/PKGBUILD)
  libxi/repos/testing-i686/fix-gtk2-segfault.patch
    (from rev 278796, libxi/trunk/fix-gtk2-segfault.patch)
  libxi/repos/testing-x86_64/
  libxi/repos/testing-x86_64/PKGBUILD
    (from rev 278796, libxi/trunk/PKGBUILD)
  libxi/repos/testing-x86_64/fix-gtk2-segfault.patch
    (from rev 278796, libxi/trunk/fix-gtk2-segfault.patch)

----------------------------------------+
 testing-i686/PKGBUILD                  |   40 +++++
 testing-i686/fix-gtk2-segfault.patch   |  241 +++++++++++++++++++++++++++++++
 testing-x86_64/PKGBUILD                |   40 +++++
 testing-x86_64/fix-gtk2-segfault.patch |  241 +++++++++++++++++++++++++++++++
 4 files changed, 562 insertions(+)

Copied: libxi/repos/testing-i686/PKGBUILD (from rev 278796, libxi/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD	                        (rev 0)
+++ testing-i686/PKGBUILD	2016-10-13 16:37:19 UTC (rev 278797)
@@ -0,0 +1,40 @@
+# $Id$
+# Maintainer: AndyRTR <andyrtr at archlinux.org>
+# Maintainer: Jan de Groot <jgc at archlinux.org>
+
+pkgname=libxi
+pkgver=1.7.7
+pkgrel=2
+pkgdesc="X11 Input extension library"
+arch=('i686' 'x86_64')
+url="http://xorg.freedesktop.org"
+depends=('libxext' 'inputproto')
+makedepends=('pkgconfig' 'xorg-util-macros' 'libxfixes' 'automake')
+license=('custom')
+source=(${url}/releases/individual/lib/libXi-${pkgver}.tar.bz2{,.sig}
+        fix-gtk2-segfault.patch)
+sha256sums=('996f834fa57b9b33ba36690f6f5c6a29320bc8213022943912462d8015b1e030'
+            'SKIP'
+            '34ac1854b6bb14cbb048ddbd20cce7a4b2ad1e8ffa6b116aa20b0dfc56655c4b')
+validpgpkeys=('3C2C43D9447D5938EF4551EBE23B7E70B467F0BF') # Peter Hutterer
+validpgpkeys+=('C41C985FDCF1E5364576638B687393EE37D128F8') # Matthieu Herrb <matthieu.herrb at laas.fr>
+
+prepare() {
+  cd libXi-${pkgver}
+  #fix FS#51298
+  patch -Np1 -i ../fix-gtk2-segfault.patch
+}
+
+build() {
+  cd libXi-${pkgver}
+  ./configure --prefix=/usr --sysconfdir=/etc --disable-static
+  make
+}
+
+package() {
+  cd libXi-${pkgver}
+  make DESTDIR="${pkgdir}" install
+
+  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}

Copied: libxi/repos/testing-i686/fix-gtk2-segfault.patch (from rev 278796, libxi/trunk/fix-gtk2-segfault.patch)
===================================================================
--- testing-i686/fix-gtk2-segfault.patch	                        (rev 0)
+++ testing-i686/fix-gtk2-segfault.patch	2016-10-13 16:37:19 UTC (rev 278797)
@@ -0,0 +1,241 @@
+From patchwork Thu Oct 13 03:58:22 2016
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v2,libXi,1/2] SizeClassInfo can return 0 even without an error
+From: Peter Hutterer <peter.hutterer at who-t.net>
+X-Patchwork-Id: 115413
+Message-Id: <1476331103-24072-1-git-send-email-peter.hutterer at who-t.net>
+To: xorg-devel at lists.freedesktop.org
+Cc: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+Date: Thu, 13 Oct 2016 13:58:22 +1000
+
+From: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+
+Catch the error case separately. Commit 19a9cd607d added length checking to
+SizeClassInfo but re-used the return value of 0 for an error. A device without
+classes (as is initialized by xf86-input-libinput for tablets) can
+legitimately return 0 and erroneously triggers an error.
+Fix this by using a separate value for the error.
+
+Reproducible by calling XListInputDevices() with a tablet attached.
+
+This fixes a regression introduced in commit 19a9cd607d.
+
+Signed-off-by: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+Changes to v1:
+- don't touch *size until we're sure.
+- expand commit message
+
+Niels:
+I left you as author and your signed-off-by since it's essentially your
+patch with a minor change.
+
+ src/XListDev.c | 24 +++++++++++++-----------
+ 1 file changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/src/XListDev.c b/src/XListDev.c
+index f850cd0..e4bd3d5 100644
+--- a/src/XListDev.c
++++ b/src/XListDev.c
+@@ -73,27 +73,28 @@ static int pad_to_xid(int base_size)
+     return ((base_size + padsize - 1)/padsize) * padsize;
+ }
+ 
+-static size_t
+-SizeClassInfo(xAnyClassPtr *any, size_t len, int num_classes)
++static int
++SizeClassInfo(xAnyClassPtr *any, size_t len, int num_classes, size_t *size)
+ {
+-    int size = 0;
+     int j;
++    size_t sz = 0;
++
+     for (j = 0; j < num_classes; j++) {
+         switch ((*any)->class) {
+             case KeyClass:
+-                size += pad_to_xid(sizeof(XKeyInfo));
++                sz += pad_to_xid(sizeof(XKeyInfo));
+                 break;
+             case ButtonClass:
+-                size += pad_to_xid(sizeof(XButtonInfo));
++                sz += pad_to_xid(sizeof(XButtonInfo));
+                 break;
+             case ValuatorClass:
+                 {
+                     xValuatorInfoPtr v;
+ 
+                     if (len < sizeof(v))
+-                        return 0;
++                        return 1;
+                     v = (xValuatorInfoPtr) *any;
+-                    size += pad_to_xid(sizeof(XValuatorInfo) +
++                    sz += pad_to_xid(sizeof(XValuatorInfo) +
+                         (v->num_axes * sizeof(XAxisInfo)));
+                     break;
+                 }
+@@ -101,11 +102,13 @@ SizeClassInfo(xAnyClassPtr *any, size_t len, int num_classes)
+                 break;
+         }
+         if ((*any)->length > len)
+-            return 0;
++            return 1;
+         *any = (xAnyClassPtr) ((char *)(*any) + (*any)->length);
+     }
+ 
+-    return size;
++    *size = sz;
++
++    return 0;
+ }
+ 
+ static void
+@@ -220,8 +223,7 @@ XListInputDevices(
+ 	sav_any = any;
+ 	end = (char *)list + rlen;
+ 	for (i = 0; i < *ndevices; i++, list++) {
+-            s = SizeClassInfo(&any, end - (char *)any, (int)list->num_classes);
+-            if (!s)
++            if(SizeClassInfo(&any, end - (char *)any, (int)list->num_classes, &s))
+                 goto out;
+             size += s;
+ 	}
+
+From patchwork Thu Oct 13 03:58:23 2016
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v2, libXi,
+ 2/2] XListInputDevices: don't touch ndevices in case of error
+From: Peter Hutterer <peter.hutterer at who-t.net>
+X-Patchwork-Id: 115414
+Message-Id: <1476331103-24072-2-git-send-email-peter.hutterer at who-t.net>
+To: xorg-devel at lists.freedesktop.org
+Cc: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+Date: Thu, 13 Oct 2016 13:58:23 +1000
+
+We used to always set *ndevices to the number of devices returned by the
+server. This magically worked because we pretty much never returned an error
+except on faulty server or library implementations. With 19a9cd60 we now have
+more chances of getting an error, so the polite thing is to just leave *ndevices
+alone when we error out.
+
+Document it as such in the man page, just in case someone accidentally reads
+it.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+CC: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+---
+Changes to v1:
+- Niels' first patch set ndevices to 0, this one leaves it untouched
+
+ man/XListInputDevices.txt | 12 ++++++++++--
+ src/XListDev.c            | 21 ++++++++++++---------
+ 2 files changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/man/XListInputDevices.txt b/man/XListInputDevices.txt
+index 276660d..450f377 100644
+--- a/man/XListInputDevices.txt
++++ b/man/XListInputDevices.txt
+@@ -220,5 +220,13 @@ DESCRIPTION
+    Floating. If the device is a master device, attached specifies
+    the device ID of the master device this device is paired with.
+ 
+-   To free the XDeviceInfo array created by XListInputDevices, use
+-   XFreeDeviceList.
++RETURN VALUE
++------------
++
++   XListInputDevices returns a pointer to an array of XDeviceInfo
++   structs and sets ndevices_return to the number of elements in
++   that array. To free the XDeviceInfo array created by
++   XListInputDevices, use XFreeDeviceList.
++
++   On error, XListInputDevices returns NULL and ndevices_return is
++   left unmodified.
+diff --git a/src/XListDev.c b/src/XListDev.c
+index e4bd3d5..dda6011 100644
+--- a/src/XListDev.c
++++ b/src/XListDev.c
+@@ -175,7 +175,7 @@ ParseClassInfo(xAnyClassPtr *any, XAnyClassPtr *Any, int num_classes)
+ XDeviceInfo *
+ XListInputDevices(
+     register Display	*dpy,
+-    int			*ndevices)
++    int			*ndevices_return)
+ {
+     size_t s, size;
+     xListInputDevicesReq *req;
+@@ -190,6 +190,7 @@ XListInputDevices(
+     int i;
+     unsigned long rlen;
+     XExtDisplayInfo *info = XInput_find_display(dpy);
++    int ndevices;
+ 
+     LockDisplay(dpy);
+     if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+@@ -205,8 +206,8 @@ XListInputDevices(
+ 	return (XDeviceInfo *) NULL;
+     }
+ 
+-    if ((*ndevices = rep.ndevices)) {	/* at least 1 input device */
+-	size = *ndevices * sizeof(XDeviceInfo);
++    if ((ndevices = rep.ndevices)) {	/* at least 1 input device */
++	size = ndevices * sizeof(XDeviceInfo);
+ 	if (rep.length < (INT_MAX >> 2)) {
+ 	    rlen = rep.length << 2;	/* multiply length by 4    */
+ 	    slist = list = Xmalloc(rlen);
+@@ -219,17 +220,17 @@ XListInputDevices(
+ 	}
+ 	_XRead(dpy, (char *)list, rlen);
+ 
+-	any = (xAnyClassPtr) ((char *)list + (*ndevices * sizeof(xDeviceInfo)));
++	any = (xAnyClassPtr) ((char *)list + (ndevices * sizeof(xDeviceInfo)));
+ 	sav_any = any;
+ 	end = (char *)list + rlen;
+-	for (i = 0; i < *ndevices; i++, list++) {
++	for (i = 0; i < ndevices; i++, list++) {
+             if(SizeClassInfo(&any, end - (char *)any, (int)list->num_classes, &s))
+                 goto out;
+             size += s;
+ 	}
+ 
+ 	Nptr = ((unsigned char *)list) + rlen;
+-	for (i = 0, nptr = (unsigned char *)any; i < *ndevices; i++) {
++	for (i = 0, nptr = (unsigned char *)any; i < ndevices; i++) {
+ 	    if (nptr >= Nptr)
+ 		goto out;
+ 	    size += *nptr + 1;
+@@ -245,10 +246,10 @@ XListInputDevices(
+ 	}
+ 	sclist = clist;
+ 	Any = (XAnyClassPtr) ((char *)clist +
+-			      (*ndevices * sizeof(XDeviceInfo)));
++			      (ndevices * sizeof(XDeviceInfo)));
+ 	list = slist;
+ 	any = sav_any;
+-	for (i = 0; i < *ndevices; i++, list++, clist++) {
++	for (i = 0; i < ndevices; i++, list++, clist++) {
+ 	    clist->type = list->type;
+ 	    clist->id = list->id;
+ 	    clist->use = list->use;
+@@ -261,7 +262,7 @@ XListInputDevices(
+ 	clist = sclist;
+ 	nptr = (unsigned char *)any;
+ 	Nptr = (unsigned char *)Any;
+-	for (i = 0; i < *ndevices; i++, clist++) {
++	for (i = 0; i < ndevices; i++, clist++) {
+ 	    clist->name = (char *)Nptr;
+ 	    memcpy(Nptr, nptr + 1, *nptr);
+ 	    Nptr += (*nptr);
+@@ -270,6 +271,8 @@ XListInputDevices(
+ 	}
+     }
+ 
++    *ndevices_return = ndevices;
++
+   out:
+     XFree((char *)slist);
+     UnlockDisplay(dpy);

Copied: libxi/repos/testing-x86_64/PKGBUILD (from rev 278796, libxi/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD	                        (rev 0)
+++ testing-x86_64/PKGBUILD	2016-10-13 16:37:19 UTC (rev 278797)
@@ -0,0 +1,40 @@
+# $Id$
+# Maintainer: AndyRTR <andyrtr at archlinux.org>
+# Maintainer: Jan de Groot <jgc at archlinux.org>
+
+pkgname=libxi
+pkgver=1.7.7
+pkgrel=2
+pkgdesc="X11 Input extension library"
+arch=('i686' 'x86_64')
+url="http://xorg.freedesktop.org"
+depends=('libxext' 'inputproto')
+makedepends=('pkgconfig' 'xorg-util-macros' 'libxfixes' 'automake')
+license=('custom')
+source=(${url}/releases/individual/lib/libXi-${pkgver}.tar.bz2{,.sig}
+        fix-gtk2-segfault.patch)
+sha256sums=('996f834fa57b9b33ba36690f6f5c6a29320bc8213022943912462d8015b1e030'
+            'SKIP'
+            '34ac1854b6bb14cbb048ddbd20cce7a4b2ad1e8ffa6b116aa20b0dfc56655c4b')
+validpgpkeys=('3C2C43D9447D5938EF4551EBE23B7E70B467F0BF') # Peter Hutterer
+validpgpkeys+=('C41C985FDCF1E5364576638B687393EE37D128F8') # Matthieu Herrb <matthieu.herrb at laas.fr>
+
+prepare() {
+  cd libXi-${pkgver}
+  #fix FS#51298
+  patch -Np1 -i ../fix-gtk2-segfault.patch
+}
+
+build() {
+  cd libXi-${pkgver}
+  ./configure --prefix=/usr --sysconfdir=/etc --disable-static
+  make
+}
+
+package() {
+  cd libXi-${pkgver}
+  make DESTDIR="${pkgdir}" install
+
+  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}

Copied: libxi/repos/testing-x86_64/fix-gtk2-segfault.patch (from rev 278796, libxi/trunk/fix-gtk2-segfault.patch)
===================================================================
--- testing-x86_64/fix-gtk2-segfault.patch	                        (rev 0)
+++ testing-x86_64/fix-gtk2-segfault.patch	2016-10-13 16:37:19 UTC (rev 278797)
@@ -0,0 +1,241 @@
+From patchwork Thu Oct 13 03:58:22 2016
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v2,libXi,1/2] SizeClassInfo can return 0 even without an error
+From: Peter Hutterer <peter.hutterer at who-t.net>
+X-Patchwork-Id: 115413
+Message-Id: <1476331103-24072-1-git-send-email-peter.hutterer at who-t.net>
+To: xorg-devel at lists.freedesktop.org
+Cc: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+Date: Thu, 13 Oct 2016 13:58:22 +1000
+
+From: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+
+Catch the error case separately. Commit 19a9cd607d added length checking to
+SizeClassInfo but re-used the return value of 0 for an error. A device without
+classes (as is initialized by xf86-input-libinput for tablets) can
+legitimately return 0 and erroneously triggers an error.
+Fix this by using a separate value for the error.
+
+Reproducible by calling XListInputDevices() with a tablet attached.
+
+This fixes a regression introduced in commit 19a9cd607d.
+
+Signed-off-by: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+Changes to v1:
+- don't touch *size until we're sure.
+- expand commit message
+
+Niels:
+I left you as author and your signed-off-by since it's essentially your
+patch with a minor change.
+
+ src/XListDev.c | 24 +++++++++++++-----------
+ 1 file changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/src/XListDev.c b/src/XListDev.c
+index f850cd0..e4bd3d5 100644
+--- a/src/XListDev.c
++++ b/src/XListDev.c
+@@ -73,27 +73,28 @@ static int pad_to_xid(int base_size)
+     return ((base_size + padsize - 1)/padsize) * padsize;
+ }
+ 
+-static size_t
+-SizeClassInfo(xAnyClassPtr *any, size_t len, int num_classes)
++static int
++SizeClassInfo(xAnyClassPtr *any, size_t len, int num_classes, size_t *size)
+ {
+-    int size = 0;
+     int j;
++    size_t sz = 0;
++
+     for (j = 0; j < num_classes; j++) {
+         switch ((*any)->class) {
+             case KeyClass:
+-                size += pad_to_xid(sizeof(XKeyInfo));
++                sz += pad_to_xid(sizeof(XKeyInfo));
+                 break;
+             case ButtonClass:
+-                size += pad_to_xid(sizeof(XButtonInfo));
++                sz += pad_to_xid(sizeof(XButtonInfo));
+                 break;
+             case ValuatorClass:
+                 {
+                     xValuatorInfoPtr v;
+ 
+                     if (len < sizeof(v))
+-                        return 0;
++                        return 1;
+                     v = (xValuatorInfoPtr) *any;
+-                    size += pad_to_xid(sizeof(XValuatorInfo) +
++                    sz += pad_to_xid(sizeof(XValuatorInfo) +
+                         (v->num_axes * sizeof(XAxisInfo)));
+                     break;
+                 }
+@@ -101,11 +102,13 @@ SizeClassInfo(xAnyClassPtr *any, size_t len, int num_classes)
+                 break;
+         }
+         if ((*any)->length > len)
+-            return 0;
++            return 1;
+         *any = (xAnyClassPtr) ((char *)(*any) + (*any)->length);
+     }
+ 
+-    return size;
++    *size = sz;
++
++    return 0;
+ }
+ 
+ static void
+@@ -220,8 +223,7 @@ XListInputDevices(
+ 	sav_any = any;
+ 	end = (char *)list + rlen;
+ 	for (i = 0; i < *ndevices; i++, list++) {
+-            s = SizeClassInfo(&any, end - (char *)any, (int)list->num_classes);
+-            if (!s)
++            if(SizeClassInfo(&any, end - (char *)any, (int)list->num_classes, &s))
+                 goto out;
+             size += s;
+ 	}
+
+From patchwork Thu Oct 13 03:58:23 2016
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v2, libXi,
+ 2/2] XListInputDevices: don't touch ndevices in case of error
+From: Peter Hutterer <peter.hutterer at who-t.net>
+X-Patchwork-Id: 115414
+Message-Id: <1476331103-24072-2-git-send-email-peter.hutterer at who-t.net>
+To: xorg-devel at lists.freedesktop.org
+Cc: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+Date: Thu, 13 Oct 2016 13:58:23 +1000
+
+We used to always set *ndevices to the number of devices returned by the
+server. This magically worked because we pretty much never returned an error
+except on faulty server or library implementations. With 19a9cd60 we now have
+more chances of getting an error, so the polite thing is to just leave *ndevices
+alone when we error out.
+
+Document it as such in the man page, just in case someone accidentally reads
+it.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+CC: Niels Ole Salscheider <niels_ole at salscheider-online.de>
+---
+Changes to v1:
+- Niels' first patch set ndevices to 0, this one leaves it untouched
+
+ man/XListInputDevices.txt | 12 ++++++++++--
+ src/XListDev.c            | 21 ++++++++++++---------
+ 2 files changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/man/XListInputDevices.txt b/man/XListInputDevices.txt
+index 276660d..450f377 100644
+--- a/man/XListInputDevices.txt
++++ b/man/XListInputDevices.txt
+@@ -220,5 +220,13 @@ DESCRIPTION
+    Floating. If the device is a master device, attached specifies
+    the device ID of the master device this device is paired with.
+ 
+-   To free the XDeviceInfo array created by XListInputDevices, use
+-   XFreeDeviceList.
++RETURN VALUE
++------------
++
++   XListInputDevices returns a pointer to an array of XDeviceInfo
++   structs and sets ndevices_return to the number of elements in
++   that array. To free the XDeviceInfo array created by
++   XListInputDevices, use XFreeDeviceList.
++
++   On error, XListInputDevices returns NULL and ndevices_return is
++   left unmodified.
+diff --git a/src/XListDev.c b/src/XListDev.c
+index e4bd3d5..dda6011 100644
+--- a/src/XListDev.c
++++ b/src/XListDev.c
+@@ -175,7 +175,7 @@ ParseClassInfo(xAnyClassPtr *any, XAnyClassPtr *Any, int num_classes)
+ XDeviceInfo *
+ XListInputDevices(
+     register Display	*dpy,
+-    int			*ndevices)
++    int			*ndevices_return)
+ {
+     size_t s, size;
+     xListInputDevicesReq *req;
+@@ -190,6 +190,7 @@ XListInputDevices(
+     int i;
+     unsigned long rlen;
+     XExtDisplayInfo *info = XInput_find_display(dpy);
++    int ndevices;
+ 
+     LockDisplay(dpy);
+     if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+@@ -205,8 +206,8 @@ XListInputDevices(
+ 	return (XDeviceInfo *) NULL;
+     }
+ 
+-    if ((*ndevices = rep.ndevices)) {	/* at least 1 input device */
+-	size = *ndevices * sizeof(XDeviceInfo);
++    if ((ndevices = rep.ndevices)) {	/* at least 1 input device */
++	size = ndevices * sizeof(XDeviceInfo);
+ 	if (rep.length < (INT_MAX >> 2)) {
+ 	    rlen = rep.length << 2;	/* multiply length by 4    */
+ 	    slist = list = Xmalloc(rlen);
+@@ -219,17 +220,17 @@ XListInputDevices(
+ 	}
+ 	_XRead(dpy, (char *)list, rlen);
+ 
+-	any = (xAnyClassPtr) ((char *)list + (*ndevices * sizeof(xDeviceInfo)));
++	any = (xAnyClassPtr) ((char *)list + (ndevices * sizeof(xDeviceInfo)));
+ 	sav_any = any;
+ 	end = (char *)list + rlen;
+-	for (i = 0; i < *ndevices; i++, list++) {
++	for (i = 0; i < ndevices; i++, list++) {
+             if(SizeClassInfo(&any, end - (char *)any, (int)list->num_classes, &s))
+                 goto out;
+             size += s;
+ 	}
+ 
+ 	Nptr = ((unsigned char *)list) + rlen;
+-	for (i = 0, nptr = (unsigned char *)any; i < *ndevices; i++) {
++	for (i = 0, nptr = (unsigned char *)any; i < ndevices; i++) {
+ 	    if (nptr >= Nptr)
+ 		goto out;
+ 	    size += *nptr + 1;
+@@ -245,10 +246,10 @@ XListInputDevices(
+ 	}
+ 	sclist = clist;
+ 	Any = (XAnyClassPtr) ((char *)clist +
+-			      (*ndevices * sizeof(XDeviceInfo)));
++			      (ndevices * sizeof(XDeviceInfo)));
+ 	list = slist;
+ 	any = sav_any;
+-	for (i = 0; i < *ndevices; i++, list++, clist++) {
++	for (i = 0; i < ndevices; i++, list++, clist++) {
+ 	    clist->type = list->type;
+ 	    clist->id = list->id;
+ 	    clist->use = list->use;
+@@ -261,7 +262,7 @@ XListInputDevices(
+ 	clist = sclist;
+ 	nptr = (unsigned char *)any;
+ 	Nptr = (unsigned char *)Any;
+-	for (i = 0; i < *ndevices; i++, clist++) {
++	for (i = 0; i < ndevices; i++, clist++) {
+ 	    clist->name = (char *)Nptr;
+ 	    memcpy(Nptr, nptr + 1, *nptr);
+ 	    Nptr += (*nptr);
+@@ -270,6 +271,8 @@ XListInputDevices(
+ 	}
+     }
+ 
++    *ndevices_return = ndevices;
++
+   out:
+     XFree((char *)slist);
+     UnlockDisplay(dpy);



More information about the arch-commits mailing list