- /* Only trust user/env if kernel says we're not suid/sgid */
- if ((aux[0]&0x7800)!=0x7800 || aux[AT_UID]!=aux[AT_EUID]
- || aux[AT_GID]!=aux[AT_EGID]) {
- env_path = 0;
+ /* Find the dynamic linker's DYNAMIC section and decode it */
+ ehdr = (void *)aux[AT_BASE];
+ phdr = (void *)(aux[AT_BASE] + ehdr->e_phoff);
+ for (i=ehdr->e_phnum; i--; phdr=(void *)((char *)phdr + ehdr->e_phentsize)) {
+ if (phdr->p_type == PT_DYNAMIC) {
+ lib_dynv = (void *)(aux[AT_BASE] + phdr->p_vaddr);
+ decode_vec(lib_dynv, lib_dyn, DYN_CNT);
+ break;
+ }