aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorChris D. Faulhaber <jedgar@FreeBSD.org>2001-01-20 00:26:32 +0000
committerChris D. Faulhaber <jedgar@FreeBSD.org>2001-01-20 00:26:32 +0000
commit8728c621a021f819cd61d4cd31541d14d7bbb419 (patch)
tree8216327ea55a81f9660ddf9402f2b391405602db /usr.bin
parentc85c46678d21ac891e04a20c307a54b5f32b8106 (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/finger/util.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c
index 7823ef4dcd1c..eb9120629975 100644
--- a/usr.bin/finger/util.c
+++ b/usr.bin/finger/util.c
@@ -353,9 +353,12 @@ userinfo(pn, pw)
pn->realname = pn->office = pn->officephone = pn->homephone = NULL;
pn->uid = pw->pw_uid;
- pn->name = strdup(pw->pw_name);
- pn->dir = strdup(pw->pw_dir);
- pn->shell = strdup(pw->pw_shell);
+ if ((pn->name = strdup(pw->pw_name)) == NULL)
+ err(1, "strdup failed");
+ if ((pn->dir = strdup(pw->pw_dir)) == NULL)
+ err(1, "strdup failed");
+ if ((pn->shell = strdup(pw->pw_shell)) == NULL)
+ err(1, "strdup failed");
/* why do we skip asterisks!?!? */
(void)strncpy(bp = tbuf, pw->pw_gecos, sizeof(tbuf));
@@ -380,7 +383,8 @@ userinfo(pn, pw)
}
}
*t = '\0';
- pn->realname = strdup(name);
+ if ((pn->realname = strdup(name)) == NULL)
+ err(1, "strdup failed");
pn->office = ((p = strsep(&bp, ",")) && *p) ?
strdup(p) : NULL;
pn->officephone = ((p = strsep(&bp, ",")) && *p) ?