$OpenBSD: patch-etc_atalkd_config_c,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- etc/atalkd/config.c.orig	Wed Mar 19 10:39:30 2003
+++ etc/atalkd/config.c	Mon Aug 18 14:22:49 2003
@@ -202,9 +202,10 @@ int writeconf( cf )
     }
 
     if (( p = strrchr( path, '/' )) == NULL ) {
-	strcpy( newpath, _PATH_ATALKDTMP );
+	(void)strlcpy( newpath, _PATH_ATALKDTMP,sizeof(newpath));
     } else {
-	sprintf( newpath, "%.*s/%s", (int)(p - path), path, _PATH_ATALKDTMP );
+	snprintf( newpath,sizeof(newpath), "%.*s/%s", (int)(p - path),
+		path, _PATH_ATALKDTMP );
     }
     if (( fd = open( newpath, O_WRONLY|O_CREAT|O_TRUNC, mode )) < 0 ) {
 	LOG(log_error, logtype_atalkd, "%s: %s", newpath, strerror(errno) );
@@ -336,8 +337,7 @@ int readconf( cf )
 	 * Check that av[ 0 ] is a valid interface.
 	 * Not possible under sysV.
 	 */
-	strncpy( ifr.ifr_name, argv[ 0 ], sizeof(ifr.ifr_name) );
-	ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
+	(void)strlcpy( ifr.ifr_name, argv[ 0 ], sizeof(ifr.ifr_name));
 
 	/* for devices that don't support appletalk */
 	if ((ioctl(s, SIOCGIFADDR, &ifr) < 0) && (errno == ENODEV)) {
@@ -546,7 +546,7 @@ int net( iface, av )
 	stop++;
     }
     net = atoi( nrange );
-    if ( net < 0 || net >= 0xffff ) {
+    if ( net < 1 || net >= 0xffff ) {
 	fprintf( stderr, "Bad network: %d\n", net );
 	return -1;
     }
@@ -780,7 +780,7 @@ struct interface *newiface( name )
 int plumb()
 {
     struct interface	*iface;
-    char		device[ MAXPATHLEN + 1], *p;
+    char		device[MAXPATHLEN], *p;
     int			fd, ppa;
 
     for ( iface = interfaces; iface != NULL; iface = iface->i_next ) {
@@ -788,8 +788,8 @@ int plumb()
 	    continue;
 	}
 
-	strcpy( device, "/dev/" );
-	strcat( device, iface->i_name );
+	(void)strlcpy(device, "/dev/", sizef(device));
+	(void)strlcat(device, iface->i_name, sizeof(device));
 	if (( p = strpbrk( device, "0123456789" )) == NULL ) {
 	    LOG(log_error, logtype_atalkd, "plumb: invalid device: %s", device );
 	    return -1;
