fix public clone function to be safe and usable by applications
[musl] / src / internal / vdso.c
index 6ae0212..d46d322 100644 (file)
@@ -1,4 +1,5 @@
 #include <elf.h>
+#include <link.h>
 #include <limits.h>
 #include <stdint.h>
 #include <string.h>
@@ -44,6 +45,7 @@ void *__vdsosym(const char *vername, const char *name)
        size_t i;
        for (i=0; libc.auxv[i] != AT_SYSINFO_EHDR; i+=2)
                if (!libc.auxv[i]) return 0;
+       if (!libc.auxv[i+1]) return 0;
        Ehdr *eh = (void *)libc.auxv[i+1];
        Phdr *ph = (void *)((char *)eh + eh->e_phoff);
        size_t *dynv=0, base=-1;
@@ -57,7 +59,7 @@ void *__vdsosym(const char *vername, const char *name)
 
        char *strings = 0;
        Sym *syms = 0;
-       uint32_t *hashtab = 0;
+       Elf_Symndx *hashtab = 0;
        uint16_t *versym = 0;
        Verdef *verdef = 0;