xserver-multidpi/hw
Servaas Vandenberghe 820d9040f5 xfree86: fix potential buffer overflow
The patch below fixes a potential buffer overflow in xf86addComment().
This occurs if  curlen > 0 && eol_seen == 0 && iscomment == 0 , as
follows from the code:

char *xf86addComment(char *cur, char *add)

<...>

        len = strlen(add);
        endnewline = add[len - 1] == '\n';
        len +=  1 + iscomment + (!hasnewline) + (!endnewline) + eol_seen;

        if ((str = realloc(cur, len + curlen)) == NULL)
                return cur;

        cur = str;

        if (eol_seen || (curlen && !hasnewline))
                cur[curlen++] = '\n';
        if (!iscomment)
                cur[curlen++] = '#';
        strcpy(cur + curlen, add);
        if (!endnewline)
                strcat(cur, "\n");

Signed-off-by: Servaas Vandenberghe <vdb@picaros.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

[whot: added buffer overflow test case]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-31 09:39:04 +10:00
..
dmx Merge remote-tracking branch 'mattst88/for-keith' 2011-09-21 14:34:27 -07:00
kdrive kdrive: check for null memory, fix OOB 2011-10-25 14:06:41 +10:00
vfb Bug 38420: Xvfb crashes in miInitVisuals() when started with depth=2 2011-10-24 18:59:56 -07:00
xfree86 xfree86: fix potential buffer overflow 2011-10-31 09:39:04 +10:00
xnest Xnest: Match the host's keymap 2011-10-21 10:29:51 -07:00
xquartz XQuartz: Fix the filename of our log file 2011-10-24 16:45:36 -07:00
xwin XWinrc.man: fix warning: tab character in unquoted macro argument #35054 2011-10-19 17:22:26 -07:00
Makefile.am Catch errors in recursive relink targets 2010-03-22 00:45:57 -05:00