mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Fix allocation when handling positional parameters in printf.
This commit is contained in:
committed by
Ulrich Drepper
parent
e23fe25b33
commit
84a4211850
21
stdio-common/bug23.c
Normal file
21
stdio-common/bug23.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static char buf[32768];
|
||||
static const char expected[] = "\
|
||||
\n\
|
||||
a\n\
|
||||
abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
snprintf (buf, sizeof (buf),
|
||||
"\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
|
||||
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
|
||||
"a", "b", "c", "d", 5);
|
||||
return strcmp (buf, expected) != 0;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
Reference in New Issue
Block a user