diff options
Diffstat (limited to 'debug/tst-fortify.c')
-rw-r--r-- | debug/tst-fortify.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/debug/tst-fortify.c b/debug/tst-fortify.c index cd64936..c4c28e6 100644 --- a/debug/tst-fortify.c +++ b/debug/tst-fortify.c @@ -1853,6 +1853,30 @@ do_test (void) CHK_FAIL_END #endif + const char *ipv4str = "127.0.0.1"; + const char *ipv6str = "::1"; + + if (inet_pton (AF_INET, ipv4str, (void *) &addr) != 1) + FAIL (); + if (inet_pton (AF_INET6, ipv6str, (void *) &addr6) != 1) + FAIL (); + +#if __USE_FORTIFY_LEVEL >= 1 + char smallbuf[2]; + + CHK_FAIL_START + inet_pton (AF_INET, ipv4str, (void *) smallbuf); + CHK_FAIL_END + + CHK_FAIL_START + inet_pton (AF_INET6, ipv6str, (void *) smallbuf); + CHK_FAIL_END + + CHK_FAIL_START + inet_pton (AF_INET6, ipv6str, (void *) &addr); + CHK_FAIL_END +#endif + return ret; } |