From df3634f34f1c14f6bbdc66d9e54478384fd93eae Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 18 May 2010 15:47:33 +0000 Subject: Solved out of memory buffer write. Should also allocate place for the null ending character of a string. --- xorg-server/xkb/xkbUtils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xorg-server/xkb/xkbUtils.c b/xorg-server/xkb/xkbUtils.c index 286fab073..ab433a800 100644 --- a/xorg-server/xkb/xkbUtils.c +++ b/xorg-server/xkb/xkbUtils.c @@ -1977,7 +1977,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) /* font */ if (src->geom->label_font) { if (!dst->geom->label_font) { - tmp = malloc(strlen(src->geom->label_font)); + tmp = malloc(strlen(src->geom->label_font) + 1); if (!tmp) return FALSE; dst->geom->label_font = tmp; @@ -1985,7 +1985,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) else if (strlen(src->geom->label_font) != strlen(dst->geom->label_font)) { tmp = realloc(dst->geom->label_font, - strlen(src->geom->label_font)); + strlen(src->geom->label_font) + 1); if (!tmp) return FALSE; dst->geom->label_font = tmp; -- cgit v1.2.3