Module Name: src
Committed By: pgoyette
Date: Mon Dec 27 02:04:19 UTC 2010
Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/lib/libc: Makefile
Added Files:
src/tests/lib/libc/ssp: Makefile h_fgets.c h_getcwd.c h_gets.c
h_memcpy.c h_memmove.c h_memset.c h_raw.c h_read.c h_readlink.c
h_snprintf.c h_sprintf.c h_strcat.c h_strcpy.c h_strncat.c
h_strncpy.c h_vsnprintf.c h_vsprintf.c t_ssp.sh
Log Message:
Migrate the ssp tests from regress to atf.
Of the 17 tests, 4 fail in both the regress and atf style. 3 additional
tests fails in atf that did NOT fail in regress: gets, fgets, and read.
I will investigate why, and update when I can, but it is still useful to
get these tests into the new format where they can be exercised.
To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.7 -r1.8 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/ssp/Makefile \
src/tests/lib/libc/ssp/h_fgets.c src/tests/lib/libc/ssp/h_getcwd.c \
src/tests/lib/libc/ssp/h_gets.c src/tests/lib/libc/ssp/h_memcpy.c \
src/tests/lib/libc/ssp/h_memmove.c src/tests/lib/libc/ssp/h_memset.c \
src/tests/lib/libc/ssp/h_raw.c src/tests/lib/libc/ssp/h_read.c \
src/tests/lib/libc/ssp/h_readlink.c src/tests/lib/libc/ssp/h_snprintf.c \
src/tests/lib/libc/ssp/h_sprintf.c src/tests/lib/libc/ssp/h_strcat.c \
src/tests/lib/libc/ssp/h_strcpy.c src/tests/lib/libc/ssp/h_strncat.c \
src/tests/lib/libc/ssp/h_strncpy.c src/tests/lib/libc/ssp/h_vsnprintf.c \
src/tests/lib/libc/ssp/h_vsprintf.c src/tests/lib/libc/ssp/t_ssp.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.191 src/distrib/sets/lists/tests/mi:1.192
--- src/distrib/sets/lists/tests/mi:1.191 Sun Dec 26 13:35:54 2010
+++ src/distrib/sets/lists/tests/mi Mon Dec 27 02:04:18 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.191 2010/12/26 13:35:54 pgoyette Exp $
+# $NetBSD: mi,v 1.192 2010/12/27 02:04:18 pgoyette Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -324,6 +324,25 @@
./usr/libdata/debug/usr/tests/lib/libc/gen/t_siginfo.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/hash tests-lib-debug
./usr/libdata/debug/usr/tests/lib/libc/hash/t_sha2.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp tests-lib-debug
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_fgets.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_getcwd.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_gets.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_memcpy.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_memmove.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_memset.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_raw.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_read.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_readlink.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_snprintf.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_sprintf.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_strcat.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_strcpy.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_strncat.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_strncpy.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_vsnprintf.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/h_vsprintf.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ssp/t_ssp.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/stdio tests-lib-debug
./usr/libdata/debug/usr/tests/lib/libc/stdio/t_fmemopen.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/stdio/t_format.debug tests-lib-debug debug,atf
@@ -1558,6 +1577,26 @@
./usr/tests/lib/libc/stdlib/t_environment_pth tests-lib-tests atf
./usr/tests/lib/libc/stdlib/t_mi_vector_hash tests-lib-tests atf
./usr/tests/lib/libc/stdlib/t_strtox tests-lib-tests atf
+./usr/tests/lib/libc/ssp tests-lib-tests
+./usr/tests/lib/libc/ssp/Atffile tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_fgets tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_getcwd tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_gets tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_memcpy tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_memmove tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_memset tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_raw tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_read tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_readlink tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_snprintf tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_sprintf tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_strcat tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_strcpy tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_strncat tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_strncpy tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_vsnprintf tests-lib-tests atf
+./usr/tests/lib/libc/ssp/h_vsprintf tests-lib-tests atf
+./usr/tests/lib/libc/ssp/t_ssp tests-lib-tests atf
./usr/tests/lib/libc/stdio tests-lib-tests
./usr/tests/lib/libc/stdio/Atffile tests-lib-tests atf
./usr/tests/lib/libc/stdio/t_fmemopen tests-lib-tests atf
Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.7 src/etc/mtree/NetBSD.dist.tests:1.8
--- src/etc/mtree/NetBSD.dist.tests:1.7 Sat Dec 25 21:10:25 2010
+++ src/etc/mtree/NetBSD.dist.tests Mon Dec 27 02:04:19 2010
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.dist.tests,v 1.7 2010/12/25 21:10:25 pgoyette Exp $
+# $NetBSD: NetBSD.dist.tests,v 1.8 2010/12/27 02:04:19 pgoyette Exp $
./usr/libdata/debug/usr/tests
./usr/libdata/debug/usr/tests/atf
@@ -47,6 +47,7 @@
./usr/libdata/debug/usr/tests/lib/libc
./usr/libdata/debug/usr/tests/lib/libc/gen
./usr/libdata/debug/usr/tests/lib/libc/hash
+./usr/libdata/debug/usr/tests/lib/libc/ssp
./usr/libdata/debug/usr/tests/lib/libc/stdio
./usr/libdata/debug/usr/tests/lib/libc/stdlib
./usr/libdata/debug/usr/tests/lib/libc/string
@@ -140,6 +141,7 @@
./usr/tests/lib/libc
./usr/tests/lib/libc/gen
./usr/tests/lib/libc/hash
+./usr/tests/lib/libc/ssp
./usr/tests/lib/libc/stdio
./usr/tests/lib/libc/stdlib
./usr/tests/lib/libc/string
Index: src/tests/lib/libc/Makefile
diff -u src/tests/lib/libc/Makefile:1.9 src/tests/lib/libc/Makefile:1.10
--- src/tests/lib/libc/Makefile:1.9 Sat Dec 25 21:10:25 2010
+++ src/tests/lib/libc/Makefile Mon Dec 27 02:04:19 2010
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.9 2010/12/25 21:10:25 pgoyette Exp $
+# $NetBSD: Makefile,v 1.10 2010/12/27 02:04:19 pgoyette Exp $
.include <bsd.own.mk>
-TESTS_SUBDIRS+= gen hash stdlib stdio string
+TESTS_SUBDIRS+= gen hash ssp stdlib stdio string
TESTSDIR= ${TESTSBASE}/lib/libc
Added files:
Index: src/tests/lib/libc/ssp/Makefile
diff -u /dev/null src/tests/lib/libc/ssp/Makefile:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/Makefile Mon Dec 27 02:04:19 2010
@@ -0,0 +1,47 @@
+# $NetBSD: Makefile,v 1.1 2010/12/27 02:04:19 pgoyette Exp $
+
+NOMAN= # defined
+
+.include <bsd.own.mk>
+
+WARNS= 4
+
+CPPFLAGS+= -D_FORTIFY_SOURCE=2
+CFLAGS+= -fstack-protector-all -Wstack-protector
+LDFLAGS+= -fstack-protector-all -Wstack-protector
+
+# Bootstrap hack
+
+.ifmake !clean && !obj && !cleandir
+.BEGIN:
+ ${AR} cr libssp_nonshared.a
+.endif
+
+CLEANFILES+= libssp_nonshared.a
+LDFLAGS+= -L.
+
+TESTSDIR= ${TESTSBASE}/lib/libc/ssp
+
+TESTS_SH+= t_ssp
+
+BINDIR= ${TESTSDIR}
+
+PROGS= h_fgets
+PROGS+= h_gets
+PROGS+= h_getcwd
+PROGS+= h_memcpy
+PROGS+= h_memmove
+PROGS+= h_memset
+PROGS+= h_raw
+PROGS+= h_read
+PROGS+= h_readlink
+PROGS+= h_snprintf
+PROGS+= h_sprintf
+PROGS+= h_strcat
+PROGS+= h_strcpy
+PROGS+= h_strncat
+PROGS+= h_strncpy
+PROGS+= h_vsnprintf
+PROGS+= h_vsprintf
+
+.include <bsd.test.mk>
Index: src/tests/lib/libc/ssp/h_fgets.c
diff -u /dev/null src/tests/lib/libc/ssp/h_fgets.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_fgets.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,46 @@
+/* $NetBSD: h_fgets.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_fgets.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ int len = atoi(argv[1]);
+ (void)fgets(b, len, stdin);
+ (void)printf("%s\n", b);
+
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_getcwd.c
diff -u /dev/null src/tests/lib/libc/ssp/h_getcwd.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_getcwd.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,47 @@
+/* $NetBSD: h_getcwd.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_getcwd.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[MAXPATHLEN];
+ size_t len = atoi(argv[1]);
+ (void)getcwd(b, len);
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_gets.c
diff -u /dev/null src/tests/lib/libc/ssp/h_gets.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_gets.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,43 @@
+/* $NetBSD: h_gets.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_gets.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ (void)gets(b);
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_memcpy.c
diff -u /dev/null src/tests/lib/libc/ssp/h_memcpy.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_memcpy.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,48 @@
+/* $NetBSD: h_memcpy.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_memcpy.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ int len = atoi(argv[1]);
+
+ (void)memcpy(b, "1020202020202", len);
+ (void)printf("%*.*s\n", len, len, b);
+
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_memmove.c
diff -u /dev/null src/tests/lib/libc/ssp/h_memmove.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_memmove.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,48 @@
+/* $NetBSD: h_memmove.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_memmove.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ int len = atoi(argv[1]);
+
+ (void)memmove(b, "1020202020202", len);
+ (void)printf("%*.*s\n", len, len, b);
+
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_memset.c
diff -u /dev/null src/tests/lib/libc/ssp/h_memset.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_memset.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,45 @@
+/* $NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ size_t len = atoi(argv[1]);
+ (void)memset(b, 0, len);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_raw.c
diff -u /dev/null src/tests/lib/libc/ssp/h_raw.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_raw.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,55 @@
+/* $NetBSD: h_raw.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_raw.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static void raw(char *, size_t);
+
+static void
+raw(char *b, size_t len) {
+ b[len] = '\0';
+}
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ size_t len = atoi(argv[1]);
+
+ (void)strncpy(b, "0000000000", sizeof(b));
+ raw(b, len);
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_read.c
diff -u /dev/null src/tests/lib/libc/ssp/h_read.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_read.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,47 @@
+/* $NetBSD: h_read.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_read.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[MAXPATHLEN];
+ size_t len = atoi(argv[1]);
+ (void)read(0, b, len);
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_readlink.c
diff -u /dev/null src/tests/lib/libc/ssp/h_readlink.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_readlink.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,47 @@
+/* $NetBSD: h_readlink.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_readlink.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[MAXPATHLEN];
+ size_t len = atoi(argv[1]);
+ (void)readlink("/", b, len);
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_snprintf.c
diff -u /dev/null src/tests/lib/libc/ssp/h_snprintf.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_snprintf.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,45 @@
+/* $NetBSD: h_snprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_snprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ size_t len = atoi(argv[1]);
+ (void)snprintf(b, len, "%s", "0123456789");
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_sprintf.c
diff -u /dev/null src/tests/lib/libc/ssp/h_sprintf.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_sprintf.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,43 @@
+/* $NetBSD: h_sprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_sprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ (void)sprintf(b, "%s", argv[1]);
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_strcat.c
diff -u /dev/null src/tests/lib/libc/ssp/h_strcat.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_strcat.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,46 @@
+/* $NetBSD: h_strcat.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_strcat.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <string.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ (void)strcpy(b, "1");
+ (void)strcat(b, argv[1]);
+
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_strcpy.c
diff -u /dev/null src/tests/lib/libc/ssp/h_strcpy.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_strcpy.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,45 @@
+/* $NetBSD: h_strcpy.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_strcpy.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <string.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ (void)strcpy(b, argv[1]);
+
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_strncat.c
diff -u /dev/null src/tests/lib/libc/ssp/h_strncat.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_strncat.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,48 @@
+/* $NetBSD: h_strncat.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_strncat.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ int len = atoi(argv[1]);
+ (void)strcpy(b, "1");
+ (void)strncat(b, "1020202020202", len);
+
+ (void)printf("%*.*s\n", len, len, b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_strncpy.c
diff -u /dev/null src/tests/lib/libc/ssp/h_strncpy.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_strncpy.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,47 @@
+/* $NetBSD: h_strncpy.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_strncpy.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ int len = atoi(argv[1]);
+ (void)strncpy(b, "1020202020202", len);
+
+ (void)printf("%*.*s\n", len, len, b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_vsnprintf.c
diff -u /dev/null src/tests/lib/libc/ssp/h_vsnprintf.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_vsnprintf.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,57 @@
+/* $NetBSD: h_vsnprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_vsnprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+static void wrap(char *str, size_t, const char *, ...);
+
+static void
+wrap(char *str, size_t len, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ (void)vsnprintf(str, len, fmt, ap);
+ va_end(ap);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ size_t len = atoi(argv[1]);
+ wrap(b, len, "%s", "012345678910");
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/h_vsprintf.c
diff -u /dev/null src/tests/lib/libc/ssp/h_vsprintf.c:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/h_vsprintf.c Mon Dec 27 02:04:19 2010
@@ -0,0 +1,55 @@
+/* $NetBSD: h_vsprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2008\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: h_vsprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+
+#include <stdio.h>
+#include <stdarg.h>
+
+static void wrap(char *str, const char *, ...);
+
+static void
+wrap(char *str, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ (void)vsprintf(str, fmt, ap);
+ va_end(ap);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char b[10];
+ wrap(b, "%s", argv[1]);
+ (void)printf("%s\n", b);
+ return 0;
+}
Index: src/tests/lib/libc/ssp/t_ssp.sh
diff -u /dev/null src/tests/lib/libc/ssp/t_ssp.sh:1.1
--- /dev/null Mon Dec 27 02:04:19 2010
+++ src/tests/lib/libc/ssp/t_ssp.sh Mon Dec 27 02:04:19 2010
@@ -0,0 +1,280 @@
+# $NetBSD: t_ssp.sh,v 1.1 2010/12/27 02:04:19 pgoyette Exp $
+#
+# Copyright (c) 2008 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+h_pass()
+{
+ echo "Executing command [ $1 ]"
+ atf_check -s exit:0 -o ignore -e ignore $1
+}
+
+h_fail()
+{
+ echo "Executing command [ $1 ]"
+ atf_check -s signal:6 -o ignore -e ignore $1
+}
+
+atf_test_case raw
+raw_head()
+{
+ atf_set "descr" "Checks basic stack protection"
+}
+raw_body()
+{
+ prog="$(atf_get_srcdir)/h_raw"
+
+ h_pass "$prog 9"
+ h_fail "$prog 10"
+}
+
+atf_test_case sprintf
+sprintf_head()
+{
+ atf_set "descr" "Checks sprintf(3)"
+}
+sprintf_body()
+{
+ prog="$(atf_get_srcdir)/h_sprintf"
+
+ h_pass "$prog ok"
+ h_fail "$prog 0123456789"
+}
+
+atf_test_case vsprintf
+vsprintf_head()
+{
+ atf_set "descr" "Checks vsprintf(3)"
+}
+vsprintf_body()
+{
+ prog="$(atf_get_srcdir)/h_vsprintf"
+
+ h_pass "$prog ok"
+ h_fail "$prog 0123456789"
+}
+
+atf_test_case snprintf
+snprintf_head()
+{
+ atf_set "descr" "Checks snprintf(3)"
+}
+snprintf_body()
+{
+ prog="$(atf_get_srcdir)/h_snprintf"
+
+ h_pass "$prog 10"
+ h_fail "$prog 11"
+}
+
+atf_test_case vsnprintf
+vsnprintf_head()
+{
+ atf_set "descr" "Checks vsnprintf(3)"
+}
+vsnprintf_body()
+{
+ prog="$(atf_get_srcdir)/h_vsnprintf"
+
+ h_pass "$prog 10"
+ h_fail "$prog 11"
+}
+
+atf_test_case gets
+gets_head()
+{
+ atf_set "descr" "Checks gets(3)"
+}
+gets_body()
+{
+ prog="$(atf_get_srcdir)/h_gets"
+
+ h_pass "echo ok | $prog"
+ h_fail "echo 0123456789 | $prog"
+}
+
+atf_test_case fgets
+fgets_head()
+{
+ atf_set "descr" "Checks fgets(3)"
+}
+fgets_body()
+{
+ prog="$(atf_get_srcdir)/h_fgets"
+
+ h_pass "echo ok | $prog 10"
+ h_fail "echo busted | $prog 11"
+}
+
+atf_test_case memcpy
+memcpy_head()
+{
+ atf_set "descr" "Checks memcpy(3)"
+}
+memcpy_body()
+{
+ prog="$(atf_get_srcdir)/h_memcpy"
+
+ h_pass "$prog 10"
+ h_fail "$prog 11"
+}
+
+atf_test_case memmove
+memmove_head()
+{
+ atf_set "descr" "Checks memmove(3)"
+}
+memmove_body()
+{
+ prog="$(atf_get_srcdir)/h_memmove"
+
+ h_pass "$prog 10"
+ h_fail "$prog 11"
+}
+
+atf_test_case memset
+memset_head()
+{
+ atf_set "descr" "Checks memset(3)"
+}
+memset_body()
+{
+ prog="$(atf_get_srcdir)/h_memset"
+
+ h_pass "$prog 10"
+ h_fail "$prog 11"
+}
+
+atf_test_case strcpy
+strcpy_head()
+{
+ atf_set "descr" "Checks strcpy(3)"
+}
+strcpy_body()
+{
+ prog="$(atf_get_srcdir)/h_strcpy"
+
+ h_pass "$prog 0123456"
+ h_fail "$prog 0123456789"
+}
+
+atf_test_case strcat
+strcat_head()
+{
+ atf_set "descr" "Checks strcat(3)"
+}
+strcat_body()
+{
+ prog="$(atf_get_srcdir)/h_strcat"
+
+ h_pass "$prog 0123456"
+ h_fail "$prog 012345678"
+}
+
+atf_test_case strncpy
+strncpy_head()
+{
+ atf_set "descr" "Checks strncpy(3)"
+}
+strncpy_body()
+{
+ prog="$(atf_get_srcdir)/h_strncpy"
+
+ h_pass "$prog 10"
+ h_fail "$prog 11"
+}
+
+atf_test_case strncat
+strncat_head()
+{
+ atf_set "descr" "Checks strncat(3)"
+}
+strncat_body()
+{
+ prog="$(atf_get_srcdir)/h_strncat"
+
+ h_pass "$prog 8"
+ h_fail "$prog 9"
+}
+
+atf_test_case read
+read_head()
+{
+ atf_set "descr" "Checks read(2)"
+}
+read_body()
+{
+ prog="$(atf_get_srcdir)/h_read"
+
+ h_pass "echo foo | $prog 1024"
+ h_fail "echo bar | $prog 1025"
+}
+
+atf_test_case readlink
+readlink_head()
+{
+ atf_set "descr" "Checks readlink(2)"
+}
+readlink_body()
+{
+ prog="$(atf_get_srcdir)/h_readlink"
+
+ h_pass "$prog 1024"
+ h_fail "$prog 1025"
+}
+
+atf_test_case getcwd
+getcwd_head()
+{
+ atf_set "descr" "Checks getcwd(3)"
+}
+getcwd_body()
+{
+ prog="$(atf_get_srcdir)/h_getcwd"
+
+ h_pass "$prog 1024"
+ h_fail "$prog 1025"
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case raw
+ atf_add_test_case sprintf
+ atf_add_test_case vsprintf
+ atf_add_test_case snprintf
+ atf_add_test_case vsnprintf
+ atf_add_test_case gets
+ atf_add_test_case fgets
+ atf_add_test_case memcpy
+ atf_add_test_case memmove
+ atf_add_test_case memset
+ atf_add_test_case strcat
+ atf_add_test_case strcpy
+ atf_add_test_case strncat
+ atf_add_test_case strncpy
+ atf_add_test_case read
+ atf_add_test_case readlink
+ atf_add_test_case getcwd
+}