When (re)allocating space for an array of pointers to char, use
sizeof(*list), not sizeof(**list). (i.e., sizeof(pointer) rather than sizeof(char)). It is possible that this buffer overflow is exploitable, but it was added after RELENG_5 forked and hasn't been MFCed, so this will not receive an advisory. Submitted by: Vitezslav Novy MFC after: 1 day
This commit is contained in:
parent
e26a9b9fff
commit
25284732cd
@ -83,7 +83,7 @@ _pam_exec(pam_handle_t *pamh __unused, int flags __unused,
|
||||
for (envlen = 0; envlist[envlen] != NULL; ++envlen)
|
||||
/* nothing */ ;
|
||||
nitems = sizeof(env_items) / sizeof(*env_items);
|
||||
tmp = realloc(envlist, (envlen + nitems + 1) * sizeof **envlist);
|
||||
tmp = realloc(envlist, (envlen + nitems + 1) * sizeof(*envlist));
|
||||
if (tmp == NULL) {
|
||||
openpam_free_envlist(envlist);
|
||||
return (PAM_BUF_ERR);
|
||||
|
Loading…
Reference in New Issue
Block a user