Properly handle absent AT_CANARY aux entry.

Submitted by:	Andrey Zonov <andrey zonov org>
MFC after:	3 days
This commit is contained in:
Konstantin Belousov 2012-04-05 18:47:54 +00:00
parent 35818d2e94
commit 3f4e35f752
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=233927

View File

@ -351,7 +351,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
main_argc = argc;
main_argv = argv;
if (aux_info[AT_CANARY]->a_un.a_ptr != NULL) {
if (aux_info[AT_CANARY] != NULL &&
aux_info[AT_CANARY]->a_un.a_ptr != NULL) {
i = aux_info[AT_CANARYLEN]->a_un.a_val;
if (i > sizeof(__stack_chk_guard))
i = sizeof(__stack_chk_guard);