Index: lib/libc/gen/auxv.c =================================================================== --- lib/libc/gen/auxv.c +++ lib/libc/gen/auxv.c @@ -67,8 +67,7 @@ } static pthread_once_t aux_once = PTHREAD_ONCE_INIT; -static int pagesize, osreldate, ncpus, bsdflags; -static size_t canary_len, pagesizes_len; +static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags; static int hwcap_present, hwcap2_present; static char *canary, *pagesizes, *execpath; static void *ps_strings, *timekeep; @@ -246,7 +245,6 @@ _elf_aux_info(int aux, void *buf, int buflen) { int res; - size_t buflen_; __init_elf_aux_vector(); if (__elf_aux_vector == NULL) @@ -255,12 +253,11 @@ if (buflen < 0) return (EINVAL); - buflen_ = (size_t)buflen; switch (aux) { case AT_CANARY: - if (canary != NULL && canary_len >= buflen_) { - memcpy(buf, canary, buflen_); + if (canary != NULL && canary_len >= buflen) { + memcpy(buf, canary, buflen); memset(canary, 0, canary_len); canary = NULL; res = 0; @@ -273,35 +270,36 @@ else if (buf == NULL) res = EINVAL; else { - if (strlcpy(buf, execpath, buflen_) >= buflen_) + if (strlcpy(buf, execpath, buflen) >= + (unsigned int)buflen) res = EINVAL; else res = 0; } break; case AT_HWCAP: - if (hwcap_present && buflen_ == sizeof(u_long)) { + if (hwcap_present && buflen == sizeof(u_long)) { *(u_long *)buf = hwcap; res = 0; } else res = ENOENT; break; case AT_HWCAP2: - if (hwcap2_present && buflen_ == sizeof(u_long)) { + if (hwcap2_present && buflen == sizeof(u_long)) { *(u_long *)buf = hwcap2; res = 0; } else res = ENOENT; break; case AT_PAGESIZES: - if (pagesizes != NULL && pagesizes_len >= buflen_) { - memcpy(buf, pagesizes, buflen_); + if (pagesizes != NULL && pagesizes_len >= buflen) { + memcpy(buf, pagesizes, buflen); res = 0; } else res = ENOENT; break; case AT_PAGESZ: - if (buflen_ == sizeof(int)) { + if (buflen == sizeof(int)) { if (pagesize != 0) { *(int *)buf = pagesize; res = 0; @@ -311,7 +309,7 @@ res = EINVAL; break; case AT_OSRELDATE: - if (buflen_ == sizeof(int)) { + if (buflen == sizeof(int)) { if (osreldate != 0) { *(int *)buf = osreldate; res = 0; @@ -321,7 +319,7 @@ res = EINVAL; break; case AT_NCPUS: - if (buflen_ == sizeof(int)) { + if (buflen == sizeof(int)) { if (ncpus != 0) { *(int *)buf = ncpus; res = 0; @@ -331,7 +329,7 @@ res = EINVAL; break; case AT_TIMEKEEP: - if (buflen_ == sizeof(void *)) { + if (buflen == sizeof(void *)) { if (timekeep != NULL) { *(void **)buf = timekeep; res = 0; @@ -341,14 +339,14 @@ res = EINVAL; break; case AT_BSDFLAGS: - if (buflen_ == sizeof(int)) { + if (buflen == sizeof(int)) { *(int *)buf = bsdflags; res = 0; } else res = EINVAL; break; case AT_PS_STRINGS: - if (buflen_ == sizeof(void *)) { + if (buflen == sizeof(void *)) { if (ps_strings != NULL) { *(void **)buf = ps_strings; res = 0;