diff options
Diffstat (limited to 'usr.bin/finger')
-rw-r--r-- | usr.bin/finger/util.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c index 7823ef4..eb91206 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) ? |