mirror of git://anongit.mindrot.org/openssh.git
Suppress warning for snprintf truncation test.
This commit is contained in:
parent
47742c513e
commit
5fbb7a1349
|
@ -25,6 +25,9 @@
|
|||
#include <stdarg.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 void
|
||||
|
@ -50,9 +53,11 @@ main(void)
|
|||
{
|
||||
char b[5];
|
||||
char *src = NULL;
|
||||
int ret;
|
||||
|
||||
snprintf(b,5,"123456789");
|
||||
if (b[4] != '\0')
|
||||
memset(b, 'X', sizeof(b));
|
||||
ret = snprintf(b, 5, "123456789");
|
||||
if (ret != 9 || b[4] != '\0')
|
||||
fail("snprintf does not correctly terminate long strings");
|
||||
|
||||
/* check for read overrun on unterminated string */
|
||||
|
|
Loading…
Reference in New Issue