diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-08-19 17:06:38 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-08-19 17:06:38 +0000 |
commit | 1147469ad9dcb4eaedfc7c443ef910030b5703ae (patch) | |
tree | 07002cbe0357a446b62d8a5185d8c247bb305514 /usr.sbin | |
parent | e370520adfb0df5b66cc8ac3ff83512a32625580 (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.c | 8 |
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'; } |