summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-08-19 17:06:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-08-19 17:06:38 +0000
commit1147469ad9dcb4eaedfc7c443ef910030b5703ae (patch)
tree07002cbe0357a446b62d8a5185d8c247bb305514 /usr.sbin
parente370520adfb0df5b66cc8ac3ff83512a32625580 (diff)
buf oflows; reported by felix@schlund.de but fixed by me because he did not send in a patch
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rpc.pcnfsd/pcnfsd_cache.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/rpc.pcnfsd/pcnfsd_cache.c b/usr.sbin/rpc.pcnfsd/pcnfsd_cache.c
index 7868f1a4267..12f5b9d4862 100644
--- a/usr.sbin/rpc.pcnfsd/pcnfsd_cache.c
+++ b/usr.sbin/rpc.pcnfsd/pcnfsd_cache.c
@@ -42,7 +42,7 @@ struct cache
{
int cuid;
int cgid;
- char cpw[32];
+ char cpw[_PASSWORD_LEN];
char cuname[10]; /* keep this even for machines
* with alignment problems */
}User_cache[CACHE_SIZE];
@@ -94,8 +94,10 @@ add_cache_entry(p)
User_cache[i] = User_cache[i - 1];
User_cache[0].cuid = p->pw_uid;
User_cache[0].cgid = p->pw_gid;
- (void)strcpy(User_cache[0].cpw, p->pw_passwd);
- (void)strcpy(User_cache[0].cuname, p->pw_name);
+ (void)strncpy(User_cache[0].cpw, p->pw_passwd, sizeof User_cache[0].cpw-1);
+ User_cache[0].cpw[sizeof User_cache[0].cpw-1] = '\0';
+ (void)strncpy(User_cache[0].cuname, p->pw_name, sizeof User_cache[0].cuname-1);
+ User_cache[0].cuname[sizeof User_cache[0].cuname-1] = '\0';
}