Expect :snprintf_posarg_error to blow up with a SIGSEGV on !NetBSD OSes
This commit is contained in:
parent
d57c6b5e4f
commit
952234df16
@ -36,6 +36,10 @@
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef __NetBSD__
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
ATF_TC(snprintf_c99);
|
||||
ATF_TC_HEAD(snprintf_c99, tc)
|
||||
{
|
||||
@ -116,6 +120,12 @@ ATF_TC_BODY(snprintf_posarg_error, tc)
|
||||
{
|
||||
char s[16], fmt[32];
|
||||
|
||||
#ifndef __NetBSD__
|
||||
atf_tc_expect_signal(SIGSEGV,
|
||||
"some non-NetBSD platforms including FreeBSD don't validate "
|
||||
"negative size; testcase blows up with SIGSEGV");
|
||||
#endif
|
||||
|
||||
snprintf(fmt, sizeof(fmt), "%%%zu$d", SIZE_MAX / sizeof(size_t));
|
||||
|
||||
ATF_CHECK(snprintf(s, sizeof(s), fmt, -23) == -1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user