mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-30 01:05:14 +02:00
in pick_salt() avoid dereference of NULL passwords
Apparently some NIS implementations can leave pw->pw_passwd (or the shadow equivalent) NULL. bz#2909; based on patch from Todd Eigenschink
This commit is contained in:
parent
edbb6febcc
commit
d1d301a1dd
@ -82,7 +82,8 @@ pick_salt(void)
|
|||||||
strlcpy(salt, "xx", sizeof(salt));
|
strlcpy(salt, "xx", sizeof(salt));
|
||||||
setpwent();
|
setpwent();
|
||||||
while ((pw = getpwent()) != NULL) {
|
while ((pw = getpwent()) != NULL) {
|
||||||
passwd = shadow_pw(pw);
|
if ((passwd = shadow_pw(pw)) == NULL)
|
||||||
|
continue;
|
||||||
if (passwd[0] == '$' && (p = strrchr(passwd+1, '$')) != NULL) {
|
if (passwd[0] == '$' && (p = strrchr(passwd+1, '$')) != NULL) {
|
||||||
typelen = p - passwd + 1;
|
typelen = p - passwd + 1;
|
||||||
strlcpy(salt, passwd, MIN(typelen, sizeof(salt)));
|
strlcpy(salt, passwd, MIN(typelen, sizeof(salt)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user