summaryrefslogtreecommitdiffstats
path: root/usr.bin/passwd
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1997-03-29 20:29:12 +0000
committerwpaul <wpaul@FreeBSD.org>1997-03-29 20:29:12 +0000
commitb2e5051d34b86bf4192d8670cc9e7c47bfdfae33 (patch)
tree6becd82bdcf498d22c3509fe2ce65da9b7fbc5ab /usr.bin/passwd
parent3d2a63277b84042b3b3e1caab98539fa6815ca04 (diff)
downloadFreeBSD-src-b2e5051d34b86bf4192d8670cc9e7c47bfdfae33.zip
FreeBSD-src-b2e5051d34b86bf4192d8670cc9e7c47bfdfae33.tar.gz
Fix for PR #3141: check for NULL before strdup()ing pw->pw_class.
(I'm not sure why this happens, though I suspect it may be because the server is configured with only passwd maps instead of both passwd and master.passwd maps. This is allowed, but I think in this case pw_class is left NULL, hence the problem.) Also applied similar patch to chpass/pw_yp.c just for paranoia's sake.
Diffstat (limited to 'usr.bin/passwd')
-rw-r--r--usr.bin/passwd/yp_passwd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/passwd/yp_passwd.c b/usr.bin/passwd/yp_passwd.c
index d5c05ff..3eab43a 100644
--- a/usr.bin/passwd/yp_passwd.c
+++ b/usr.bin/passwd/yp_passwd.c
@@ -101,7 +101,8 @@ for other users");
master_yppasswd.newpw.pw_gecos = strdup(pw->pw_gecos);
master_yppasswd.newpw.pw_dir = strdup(pw->pw_dir);
master_yppasswd.newpw.pw_shell = strdup(pw->pw_shell);
- master_yppasswd.newpw.pw_class = strdup(pw->pw_class);
+ master_yppasswd.newpw.pw_class = pw->pw_class != NULL ?
+ strdup(pw->pw_class) : "";
master_yppasswd.oldpass = "";
master_yppasswd.domain = yp_domain;
} else {
OpenPOWER on IntegriCloud