$OpenBSD: patch-bin_megatron_hqx_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- bin/megatron/hqx.c.orig	Mon Apr 29 11:52:49 2002
+++ bin/megatron/hqx.c	Mon Aug 18 14:02:17 2003
@@ -82,7 +82,7 @@ FILE		*rawhex, *expandhex;
 struct hqx_file_data {
     u_int32_t		forklen[ NUMFORKS ];
     u_short		forkcrc[ NUMFORKS ];
-    char		path[ MAXPATHLEN + 1];
+    char		path[MAXPATHLEN];
     u_short		headercrc;
     int			filed;
 } 		hqx;
@@ -105,7 +105,6 @@ int hqx_open( hqxfile, flags, fh, option
     int			flags, options;
     struct FHeader	*fh;
 {
-    int			maxlen;
 
 #if DEBUG
     fprintf( stderr, "megatron: entering hqx_open\n" );
@@ -142,10 +141,9 @@ int hqx_open( hqxfile, flags, fh, option
 	fprintf( stderr, "%s\n", hqxfile );
 	return( -1 );
     } else {
-	maxlen = sizeof( hqx.path ) -1;
-	strncpy( hqx.path, fh->name, maxlen );
-	strncpy( hqx.path, mtoupath( hqx.path ), maxlen );
-	strncat( hqx.path, ".hqx", maxlen - strlen( hqx.path ));
+	(void)strlcpy( hqx.path, fh->name, sizeof(hqx.path));
+	(void)strlcpy( hqx.path, mtoupath( hqx.path ), sizeof(hqx.path));
+	(void)strlcat( hqx.path, ".hqx", sizeof(hqx.path));
 	if (( hqx.filed = open( hqx.path, flags, 0666 )) < 0 ) {
 	    perror( hqx.path );
 	    return( -1 );
