1#include <stdio.h>
2#include <string.h>
3
4int
5main(int argc, char *argv[])
6{
7 char buf[100];
8 int a, b;
9 int status = 0;
10
11 sscanf ("12ab", "%dab%n", &a, &b);
12 sprintf (buf, "%d, %d", a, b);
13 puts (s: buf);
14 status |= strcmp (buf, "12, 4");
15
16 sscanf ("12ab100", "%dab%n100", &a, &b);
17 sprintf (buf, "%d, %d", a, b);
18 puts (s: buf);
19 status |= strcmp (buf, "12, 4");
20
21 return status;
22}
23

source code of glibc/stdio-common/bug9.c