aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/test/xfree86.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-04 09:28:39 +0100
committermarha <marha@users.sourceforge.net>2011-11-04 09:28:39 +0100
commit23e2767dc3e6b8891d4b55b711c70c6bc85a6f85 (patch)
tree04c538697c3afbd401afb1bb614460b16be28844 /xorg-server/test/xfree86.c
parent125500b44d0253d7fd7a59905ab730151d4f66e2 (diff)
parent02f377d5e2dd18537d0807ad63675a0970b5a37d (diff)
downloadvcxsrv-23e2767dc3e6b8891d4b55b711c70c6bc85a6f85.tar.gz
vcxsrv-23e2767dc3e6b8891d4b55b711c70c6bc85a6f85.tar.bz2
vcxsrv-23e2767dc3e6b8891d4b55b711c70c6bc85a6f85.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winglobals.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/include/scrnintstr.h xorg-server/xkb/ddxList.c xorg-server/xkb/ddxLoad.c
Diffstat (limited to 'xorg-server/test/xfree86.c')
-rw-r--r--xorg-server/test/xfree86.c26
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;
}