Small yet significant tweaks/cleanups:
- getservent: o put _yp_check() proto under #ifdef YP where it belongs o local YP buffers should be YPMAXRECORD + 2 bytes long and should be NUL terminated after copying - gethostbynis: o local YP buffer should be YPMAXRECORD + 2 bytes long - getnetbynis: o local YP buffer should be YPMAXRECORD + 2 bytes long and should be NUL terminated after copying - ether_addr: o local YP buffers should be YPMAXRECORD + 2 bytes long and should be NUL terminated after copying (in this case it's BUFSIZ + 2 bytes, but it happens that BUFSIZ == YPMAXRECORD. - gethostbydns: o nuke stray 'return(NULL)' in __dns_getanswer() (harmless but looks silly) These are 2.2 candidates. I will wait a few days to make sure these don't break anything and then, if there are no objections, move them to the 2.2 branch.
This commit is contained in:
parent
3d869b9c34
commit
7187ede063
@ -35,7 +35,7 @@
|
|||||||
* Center for Telecommunications Research
|
* Center for Telecommunications Research
|
||||||
* Columbia University, New York City
|
* Columbia University, New York City
|
||||||
*
|
*
|
||||||
* $Id: ether_addr.c,v 1.5 1996/12/05 18:46:19 jkh Exp $
|
* $Id: ether_addr.c,v 1.6 1996/12/10 17:19:09 wollman Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ int ether_ntohost(hostname, e)
|
|||||||
struct ether_addr *e;
|
struct ether_addr *e;
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ + 2];
|
||||||
struct ether_addr local_ether;
|
struct ether_addr local_ether;
|
||||||
char local_host[MAXHOSTNAMELEN];
|
char local_host[MAXHOSTNAMELEN];
|
||||||
#ifdef YP
|
#ifdef YP
|
||||||
@ -157,7 +157,8 @@ int ether_ntohost(hostname, e)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
strncpy(buf, result, resultlen);
|
strncpy(buf, result, resultlen);
|
||||||
free(result);
|
buf[resultlen] = '\0';
|
||||||
|
free(result);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!ether_line(buf, &local_ether, local_host)) {
|
if (!ether_line(buf, &local_ether, local_host)) {
|
||||||
@ -183,7 +184,7 @@ int ether_hostton(hostname, e)
|
|||||||
struct ether_addr *e;
|
struct ether_addr *e;
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ + 2];
|
||||||
struct ether_addr local_ether;
|
struct ether_addr local_ether;
|
||||||
char local_host[MAXHOSTNAMELEN];
|
char local_host[MAXHOSTNAMELEN];
|
||||||
#ifdef YP
|
#ifdef YP
|
||||||
@ -206,6 +207,7 @@ int ether_hostton(hostname, e)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
strncpy(buf, result, resultlen);
|
strncpy(buf, result, resultlen);
|
||||||
|
buf[resultlen] = '\0';
|
||||||
free(result);
|
free(result);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
|
||||||
static char rcsid[] = "$Id: gethostbydns.c,v 1.13 1996/12/22 22:05:43 wpaul Exp $";
|
static char rcsid[] = "$Id: gethostbydns.c,v 1.14 1996/12/24 02:10:24 wpaul Exp $";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -414,7 +414,6 @@ __dns_getanswer(answer, anslen, qname, qtype)
|
|||||||
host.h_addrtype = AF_INET;
|
host.h_addrtype = AF_INET;
|
||||||
host.h_length = INADDRSZ;
|
host.h_length = INADDRSZ;
|
||||||
break;
|
break;
|
||||||
return(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(gethostanswer((const querybuf *)answer, anslen, qname, qtype));
|
return(gethostanswer((const querybuf *)answer, anslen, qname, qtype));
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
static char sccsid[] = "@(#)$Id: gethostbynis.c,v 1.4 1996/08/29 20:07:54 peter Exp $";
|
static char sccsid[] = "@(#)$Id: gethostbynis.c,v 1.5 1996/12/24 17:01:49 wpaul Exp $";
|
||||||
static char rcsid[] = "$Id: gethostbynis.c,v 1.4 1996/08/29 20:07:54 peter Exp $";
|
static char rcsid[] = "$Id: gethostbynis.c,v 1.5 1996/12/24 17:01:49 wpaul Exp $";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -65,7 +65,7 @@ _gethostbynis(name, map, af)
|
|||||||
int resultlen;
|
int resultlen;
|
||||||
static struct hostent h;
|
static struct hostent h;
|
||||||
static char *domain = (char *)NULL;
|
static char *domain = (char *)NULL;
|
||||||
static char ypbuf[YPMAXRECORD];
|
static char ypbuf[YPMAXRECORD + 2];
|
||||||
|
|
||||||
switch(af) {
|
switch(af) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
static char sccsid[] = "@(#)$Id: getnetbynis.c,v 1.6 1996/08/29 20:08:01 peter Exp $";
|
static char sccsid[] = "@(#)$Id: getnetbynis.c,v 1.7 1996/12/06 00:12:31 jkh Exp $";
|
||||||
static char rcsid[] = "$Id: getnetbynis.c,v 1.6 1996/08/29 20:08:01 peter Exp $";
|
static char rcsid[] = "$Id: getnetbynis.c,v 1.7 1996/12/06 00:12:31 jkh Exp $";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -64,7 +64,7 @@ _getnetbynis(name, map, af)
|
|||||||
int resultlen;
|
int resultlen;
|
||||||
static struct netent h;
|
static struct netent h;
|
||||||
static char *domain = (char *)NULL;
|
static char *domain = (char *)NULL;
|
||||||
static char ypbuf[YPMAXRECORD];
|
static char ypbuf[YPMAXRECORD + 2];
|
||||||
|
|
||||||
switch(af) {
|
switch(af) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
@ -83,6 +83,7 @@ _getnetbynis(name, map, af)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
bcopy((char *)result, (char *)&ypbuf, resultlen);
|
bcopy((char *)result, (char *)&ypbuf, resultlen);
|
||||||
|
ypbuf[resultlen] = '\0';
|
||||||
free(result);
|
free(result);
|
||||||
result = (char *)&ypbuf;
|
result = (char *)&ypbuf;
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@ static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93";
|
|||||||
#include <rpcsvc/yp_prot.h>
|
#include <rpcsvc/yp_prot.h>
|
||||||
#include <rpcsvc/ypclnt.h>
|
#include <rpcsvc/ypclnt.h>
|
||||||
static int serv_stepping_yp = 0;
|
static int serv_stepping_yp = 0;
|
||||||
|
extern int _yp_check __P(( char ** ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int _yp_check __P(( char ** ));
|
|
||||||
|
|
||||||
#define MAXALIASES 35
|
#define MAXALIASES 35
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ _getservbyport_yp(line)
|
|||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
int resultlen;
|
int resultlen;
|
||||||
char buf[YPMAXRECORD];
|
char buf[YPMAXRECORD + 2];
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%d/%s", ntohs(___getservbyport_yp),
|
snprintf(buf, sizeof(buf), "%d/%s", ntohs(___getservbyport_yp),
|
||||||
@ -116,7 +116,7 @@ _getservbyname_yp(line)
|
|||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
int resultlen;
|
int resultlen;
|
||||||
char buf[YPMAXRECORD];
|
char buf[YPMAXRECORD + 2];
|
||||||
|
|
||||||
if(!yp_domain) {
|
if(!yp_domain) {
|
||||||
if(yp_get_default_domain(&yp_domain))
|
if(yp_get_default_domain(&yp_domain))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user