diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-23 06:43:56 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-23 06:43:56 +0000 |
commit | dc8ff7707426b922aa4226731f6e9f9364c82a16 (patch) | |
tree | e69a930f30f2cc7d8b567f4b8ea50967c4b225da /usr.sbin | |
parent | 79aa87c8bbcfb06bdbb34eb86059d7282797049f (diff) |
avoid oflows
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/rpc.pcnfsd/pcnfsd_v2.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/rpc.pcnfsd/pcnfsd_v2.c b/usr.sbin/rpc.pcnfsd/pcnfsd_v2.c index da9bab8b23b..96889a2b01d 100644 --- a/usr.sbin/rpc.pcnfsd/pcnfsd_v2.c +++ b/usr.sbin/rpc.pcnfsd/pcnfsd_v2.c @@ -112,7 +112,7 @@ char pw[64]; int c1, c2; struct passwd *p; static u_int extra_gids[EXTRAGIDLEN]; -static char home[256]; +static char home[MAXPATHLEN]; #ifdef USE_YP char *yphome; char *cp; @@ -144,7 +144,8 @@ char *cp; #ifdef USE_YP yphome = find_entry(uname, "auto.home"); if(yphome) { - strcpy(home, yphome); + strncpy(home, yphome, sizeof home-1); + home[sizeof home-1] = '\0'; free(yphome); cp = strchr(home, ':'); cp++; @@ -179,7 +180,8 @@ char *cp; #ifdef USE_YP yphome = find_entry(uname, "auto.home"); if(yphome) { - strcpy(home, yphome); + strncpy(home, yphome, sizeof home-1); + home[sizeof home-1] = '\0'; free(yphome); cp = strchr(home, ':'); cp++; @@ -356,7 +358,8 @@ static char * my_strdup(s) char *s; { -char *r; + char *r; + r = (char *)grab(strlen(s)+1); strcpy(r, s); return(r); |