diff options
| author | Bill Paul <wpaul@FreeBSD.org> | 1996-12-27 19:28:46 +0000 | 
|---|---|---|
| committer | Bill Paul <wpaul@FreeBSD.org> | 1996-12-27 19:28:46 +0000 | 
| commit | 1d2493ff77f8fcc1c7197e4fb0124db17ecf8ea3 (patch) | |
| tree | b3899e41109595c94a952b728bb8f15ac2b7d3c4 /lib/libc/gen/getgrent.c | |
| parent | 33c9a3df24c6dfea95c009d27a23e7629a7c9c6a (diff) | |
Notes
Diffstat (limited to 'lib/libc/gen/getgrent.c')
| -rw-r--r-- | lib/libc/gen/getgrent.c | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index e2cefb9c4b7c..47d229ee6e04 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -473,7 +473,7 @@ static int  _getypgroup(struct group *gr, const char *name, char *map)  {  	char *result, *s; -	static char resultbuf[1024]; +	static char resultbuf[YPMAXRECORD + 2];  	int resultlen;  	if(!_gr_yp_domain) { @@ -490,6 +490,7 @@ _getypgroup(struct group *gr, const char *name, char *map)  	if(resultlen >= sizeof resultbuf) return 0;  	strncpy(resultbuf, result, resultlen); +	resultbuf[resultlen] = '\0';  	free(result);  	return(_gr_breakout_yp(gr, resultbuf)); @@ -502,7 +503,7 @@ _nextypgroup(struct group *gr)  	static char *key;  	static int keylen;  	char *lastkey, *result; -	static char resultbuf[1024]; +	static char resultbuf[YPMAXRECORD + 2];  	int resultlen;  	int rv; @@ -537,7 +538,8 @@ unpack:  			goto tryagain;  		} -		strcpy(resultbuf, result); +		strncpy(resultbuf, result, resultlen); +		resultbuf[resultlen] = '\0';  		free(result);  		if((result = strchr(resultbuf, '\n')) != NULL)  			*result = '\0'; | 
