summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>1999-10-25 09:46:57 +0000
committersheldonh <sheldonh@FreeBSD.org>1999-10-25 09:46:57 +0000
commit5b5ad21e78e5ae7d13a17451861e0b3742bba637 (patch)
treef8f4feadef68de9a1df53e245a26fcad866d5a36 /usr.sbin
parentfde4bba9744f37bec5c6536b15db72d4d32d3189 (diff)
downloadFreeBSD-src-5b5ad21e78e5ae7d13a17451861e0b3742bba637.zip
FreeBSD-src-5b5ad21e78e5ae7d13a17451861e0b3742bba637.tar.gz
Do not rely on malloc() to zero-fill allocated memory, since it is
not documented as doing so. This fixes a potential segmentation violation. PR: 14465 Reported by: Tony Finch <fanf@demon.net>
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/vipw/vipw.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/vipw/vipw.c b/usr.sbin/vipw/vipw.c
index bf56eed..8986ab3 100644
--- a/usr.sbin/vipw/vipw.c
+++ b/usr.sbin/vipw/vipw.c
@@ -81,8 +81,9 @@ main(argc, argv)
err(1, NULL);
strcpy(masterpasswd, optarg);
if (masterpasswd[strlen(masterpasswd) - 1] != '/')
- masterpasswd[strlen(masterpasswd)] = '/';
- strcat(masterpasswd, _MASTERPASSWD);
+ strcat(masterpasswd, "/" _MASTERPASSWD);
+ else
+ strcat(masterpasswd, _MASTERPASSWD);
if ((mppath = strdup(optarg)) == NULL)
err(1, NULL);
if (mppath[strlen(mppath) - 1] == '/')
OpenPOWER on IntegriCloud