From 185312ce1c10c0d461b42467b43de79c39151d24 Mon Sep 17 00:00:00 2001 From: matthieu Date: Wed, 3 Aug 2016 19:31:23 +0000 Subject: [PATCH] xserver: fix an off-by-one error that lead to asprintf("%s", NULL) reported by deraadt@, fix reviewed in X.Org by Keith Packard. --- xserver/hw/xfree86/common/xf86AutoConfig.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xserver/hw/xfree86/common/xf86AutoConfig.c b/xserver/hw/xfree86/common/xf86AutoConfig.c index 117e5d7ab..7686280a6 100644 --- a/xserver/hw/xfree86/common/xf86AutoConfig.c +++ b/xserver/hw/xfree86/common/xf86AutoConfig.c @@ -395,8 +395,7 @@ autoConfigDevice(GDevPtr preconf_device) /* for each other driver found, copy the first screen, insert it * into the list of screens and set the driver */ - i = 0; - while (i++ < num_matches) { + for (i = 1; i < num_matches; i++) { if (!copyScreen(slp[0].screen, ptr, i, matches[i])) return NULL; }