diff options
author | marha <marha@users.sourceforge.net> | 2011-11-04 08:57:20 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-11-04 08:57:20 +0100 |
commit | 02f377d5e2dd18537d0807ad63675a0970b5a37d (patch) | |
tree | 1814c826db4d95a30ad71431d9c84b8d2611ec18 /xorg-server/test/xfree86.c | |
parent | 6f4feafd4d22beaabfb0202e66b0dea9047ee084 (diff) | |
download | vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.tar.gz vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.tar.bz2 vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.zip |
xserver pixman mesa git update 4 nov 2011
Diffstat (limited to 'xorg-server/test/xfree86.c')
-rw-r--r-- | xorg-server/test/xfree86.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/xorg-server/test/xfree86.c b/xorg-server/test/xfree86.c index 7012e90c3..448aa915e 100644 --- a/xorg-server/test/xfree86.c +++ b/xorg-server/test/xfree86.c @@ -29,6 +29,7 @@ #include "xf86.h" +#include "xf86Parser.h" static void xfree86_option_list_duplicate(void) @@ -73,9 +74,34 @@ xfree86_option_list_duplicate(void) assert(a && b); } +static void +xfree86_add_comment(void) +{ + char *current = NULL, *comment; + char compare[1024] = {0}; + + comment = "# foo"; + current = xf86addComment(current, comment); + strcpy(compare, comment); + strcat(compare, "\n"); + + assert(!strcmp(current, compare)); + + /* this used to overflow */ + strcpy(current, "\n"); + comment = "foobar\n"; + current = xf86addComment(current, comment); + strcpy(compare, "\n#"); + strcat(compare, comment); + assert(!strcmp(current, compare)); + + free(current); +} + int main(int argc, char** argv) { xfree86_option_list_duplicate(); + xfree86_add_comment(); return 0; } |