From 8c24d20933ba9c2ef0e9a81815c3be23fa896aea Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Thu, 21 Jun 2012 18:05:24 +0100 Subject: [PATCH] hw/xwin/glx: Fix glxLogExtensions to handle a null string without crashing Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/glx/indirect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index 56f677a8f..41b4cd8b3 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -473,7 +473,7 @@ static void glxLogExtensions(const char *prefix, const char *extensions) { int length = 0; - char *strl; + const char *strl; char *str = strdup(extensions); if (str == NULL) { @@ -482,6 +482,8 @@ glxLogExtensions(const char *prefix, const char *extensions) } strl = strtok(str, " "); + if (strl == NULL) + strl = ""; ErrorF("%s%s", prefix, strl); length = strlen(prefix) + strlen(strl);