From a29e765ec0c1d73ee7ef2dad3aa148214ec04335 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 22 Jul 2015 11:34:51 +0100 Subject: [PATCH] sna: Fix the last character before a colon in the fake-edid paths I chopped off one too many characters when creating the path in the presence of a colon-delimited list. Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index e1264dbd..d141b4c2 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -4333,14 +4333,14 @@ static char *fake_edid_name(xf86OutputPtr output) if (colon) len = colon - str; else - len = strlen(str) + 1; + len = strlen(str); - path = malloc(len); + path = malloc(len + 1); if (path == NULL) return NULL; - memcpy(path, str, len - 1); - path[len-1] = '\0'; + memcpy(path, str, len); + path[len] = '\0'; return path; }