Don't write the null terminator to a random place, this can trigger some segfault in XtOpenDisplay() and other annoyances.
Debian Bug #617208 <http://bugs.debian.org/617208> Signed-off-by: Cyril Brulebois <k...@debian.org> --- src/Alloc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Alan Coopersmith wrote: > I can't see why that would make XtAsprintf operate any differently though. Apparently, having HOME=/ makes the memory corruption hit XtOpenDisplay()'s %esi register, where app happens to be stored. And right after writing the null terminator at the wrong place, %esi becomes 0 in XtOpenDisplay()'s frame. Kaboom. diff --git a/src/Alloc.c b/src/Alloc.c index 67413ab..be643a8 100644 --- a/src/Alloc.c +++ b/src/Alloc.c @@ -147,7 +147,7 @@ Cardinal XtAsprintf( if (len < sizeof(buf)) { strncpy(*new_string, buf, len); - new_string[len] = '\0'; + (*new_string)[len] = '\0'; } else { -- 1.7.4.1 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel