From 1d67a8a20cbfee816666dbc088ac0288d5ad60a3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sun, 29 Jun 2008 20:41:38 +0930 Subject: [PATCH] xfree86: return an error if Screen is missing from ServerLayout #16301 This stops segfaults in the server when we try to dereference the screen section lateron. X.Org Bug 16301 --- hw/xfree86/common/xf86Config.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index ee018eb..a613716 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -1606,10 +1606,19 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, count++; adjp = (XF86ConfAdjacencyPtr)adjp->list.next; } + + if (!count) + { + xf86Msg(X_ERROR, "No screens specified in Layout \"%s\".\n", + conf_layout->lay_identifier); + return FALSE; + } + #ifdef DEBUG ErrorF("Found %d screens in the layout section %s", count, conf_layout->lay_identifier); #endif + slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec)); slp[count].screen = NULL; /* -- 1.5.4.3