Page MenuHomeFreeBSD

D56735.1795404416.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D56735.1795404416.diff

diff --git a/include/ssp/stdio.h b/include/ssp/stdio.h
--- a/include/ssp/stdio.h
+++ b/include/ssp/stdio.h
@@ -75,6 +75,13 @@
}
retbuf = __ssp_real(gets_s)(buf, len);
+
+ /*
+ * If the implementation did *not* handle the case correctly, then
+ * there's a risk that they could have corrupted us into not failing
+ * here. We have tests that cover this, so we'll just count on finding
+ * a broken implementation early on in a less hostile environmnt.
+ */
if (need_fail && retbuf != NULL)
__chk_fail();
return (retbuf);
diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile
--- a/lib/libc/tests/sys/Makefile
+++ b/lib/libc/tests/sys/Makefile
@@ -22,6 +22,7 @@
NETBSD_ATF_TESTS_C+= fsync_test
NETBSD_ATF_TESTS_C+= getcontext_test
NETBSD_ATF_TESTS_C+= getgroups_test
+FORTIFY_SOURCE.t_getgroups.c= 0
NETBSD_ATF_TESTS_C+= getitimer_test
NETBSD_ATF_TESTS_C+= getlogin_test
NETBSD_ATF_TESTS_C+= getpid_test
diff --git a/tests/sys/audit/network.c b/tests/sys/audit/network.c
--- a/tests/sys/audit/network.c
+++ b/tests/sys/audit/network.c
@@ -29,6 +29,8 @@
#include <sys/uio.h>
#include <sys/un.h>
+#include <ssp/ssp.h>
+
#include <atf-c.h>
#include <fcntl.h>
#include <stdarg.h>
@@ -959,7 +961,7 @@
snprintf(extregex, sizeof(extregex),
"recvmsg.*return,failure : Bad address");
FILE *pipefd = setup(fds, auclass);
- ATF_REQUIRE_EQ(-1, recvmsg(-1, NULL, 0));
+ ATF_REQUIRE_EQ(-1, __ssp_real(recvmsg)(-1, NULL, 0));
check_audit(fds, extregex, pipefd);
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 23, 3:26 AM (6 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41921686
Default Alt Text
D56735.1795404416.diff (1 KB)

Event Timeline