mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-02-26 02:40:38 +00:00
Suppress warning for snprintf truncation test.
This commit is contained in:
parent
47742c513e
commit
5fbb7a1349
@ -25,6 +25,9 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/* Suppress format truncation warning since we're explicitly testing that. */
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-truncation"
|
||||||
|
|
||||||
static int failed = 0;
|
static int failed = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -50,9 +53,11 @@ main(void)
|
|||||||
{
|
{
|
||||||
char b[5];
|
char b[5];
|
||||||
char *src = NULL;
|
char *src = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
snprintf(b,5,"123456789");
|
memset(b, 'X', sizeof(b));
|
||||||
if (b[4] != '\0')
|
ret = snprintf(b, 5, "123456789");
|
||||||
|
if (ret != 9 || b[4] != '\0')
|
||||||
fail("snprintf does not correctly terminate long strings");
|
fail("snprintf does not correctly terminate long strings");
|
||||||
|
|
||||||
/* check for read overrun on unterminated string */
|
/* check for read overrun on unterminated string */
|
||||||
|
Loading…
Reference in New Issue
Block a user