getopt: fix null pointer arithmetic ub
[musl] / src / locale / catclose.c
1 #define _BSD_SOURCE
2 #include <nl_types.h>
3 #include <stdint.h>
4 #include <endian.h>
5 #include <sys/mman.h>
6
7 #define V(p) be32toh(*(uint32_t *)(p))
8
9 int catclose (nl_catd catd)
10 {
11         char *map = (char *)catd;
12         munmap(map, V(map+8)+20);
13         return 0;
14 }