Add NEWS entry for CVE-2020-6096 (bug 25620)
[glibc.git] / posix / bug-regex32.c
blob525232c69bfd7bb1d53b1f79cfcfbaa877423397
1 // BZ 12811
2 #include <regex.h>
3 #include <stdio.h>
4 #include <locale.h>
6 static int
7 do_test (void)
9 char buf[1000];
10 regex_t preg;
11 if (setlocale (LC_CTYPE, "de_DE.UTF-8") == NULL)
13 puts ("setlocale failed");
14 return 1;
17 int e = regcomp (&preg, ".*ab", REG_ICASE);
18 if (e != 0)
20 regerror (e, &preg, buf, sizeof (buf));
21 printf ("regcomp = %d \"%s\"\n", e, buf);
22 return 1;
25 // Incomplete character at the end of the buffer
26 e = regexec (&preg, "aaaaaaaaaaaa\xc4", 0, NULL, 0);
28 regfree (&preg);
29 regerror (e, &preg, buf, sizeof (buf));
30 printf ("regexec = %d \"%s\"\n", e, buf);
32 return e != REG_NOMATCH;
35 #define TEST_FUNCTION do_test ()
36 #include "../test-skeleton.c"