Further harden glibc malloc metadata against 1-byte overflows.
[glibc.git] / elf / tst-tls4.c
blob63170c34786aeeeec26c5288e3ef16663d54fa91
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
6 #define TEST_FUNCTION do_test ()
7 static int
8 do_test (void)
10 static const char modname[] = "tst-tlsmod2.so";
11 int result = 0;
12 int *foop;
13 int (*fp) (int, int *);
14 void *h;
16 h = dlopen (modname, RTLD_LAZY);
17 if (h == NULL)
19 printf ("cannot open '%s': %s\n", modname, dlerror ());
20 exit (1);
23 fp = dlsym (h, "in_dso");
24 if (fp == NULL)
26 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
27 exit (1);
30 result |= fp (0, NULL);
32 foop = dlsym (h, "foo");
33 if (foop == NULL)
35 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
36 exit (1);
38 if (*foop != 16)
40 puts ("foo != 16");
41 result = 1;
44 dlclose (h);
46 return result;
50 #include "../test-skeleton.c"