$OpenBSD: patch-bin_megatron_macbin_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- bin/megatron/macbin.c.orig	Mon Aug 18 13:48:25 2003
+++ bin/megatron/macbin.c	Mon Aug 18 13:53:26 2003
@@ -54,7 +54,7 @@
  */
 struct bin_file_data {
     u_int32_t		forklen[ NUMFORKS ];
-    char		path[ MAXPATHLEN + 1];
+    char		path[MAXPATHLEN];
     int			filed;
     u_short		headercrc;
     time_t              gmtoff; /* to convert from/to localtime */
@@ -74,7 +74,6 @@ int bin_open( binfile, flags, fh, option
     int			flags, options;
     struct FHeader	*fh;
 {
-    int			maxlen;
     int			rc;
     time_t              t;
     struct tm           *tp;
@@ -112,14 +111,13 @@ int bin_open( binfile, flags, fh, option
         if (options & OPTION_STDOUT) 
 	  bin.filed = fileno(stdout);
 	else {
-	  maxlen = sizeof( bin.path ) - 1;
 #if DEBUG
 	  fprintf( stderr, "sizeof bin.path\t\t\t%d\n", sizeof( bin.path ));
 	  fprintf( stderr, "maxlen \t\t\t\t%d\n", maxlen );
 #endif /* DEBUG */
-	  strncpy( bin.path, fh->name, maxlen );
-	  strncpy( bin.path, mtoupath( bin.path ), maxlen );
-	  strncat( bin.path, ".bin", maxlen - strlen( bin.path ));
+	  (void)strlcpy( bin.path, fh->name,sizeof(bin.path));
+	  (void)strlcpy( bin.path, mtoupath( bin.path ), sizeof(bin.path));
+	  (void)strlcat( bin.path, ".bin", sizeof(bin.path));
 	  if (( bin.filed = open( bin.path, flags, 0666 )) < 0 ) {
 	    perror( bin.path );
 	    return( -1 );
