$NetBSD: patch-aa,v 1.1.1.1 2004/08/29 15:29:04 recht Exp $ --- main.c.orig Thu Aug 26 23:31:21 2004 +++ main.c Thu Aug 26 23:35:52 2004 @@ -18,6 +18,7 @@ /* rzip compression - main program */ #include "rzip.h" +#include static void usage(void) { @@ -138,9 +139,14 @@ fatal("%s: unknown suffix\n", control->infile); } - control->outfile = strndup(control->infile, + control->outfile = malloc(strlen(control->infile) - + strlen(control->suffix) + 1); + assert(control->outfile); + strncpy(control->outfile, control->infile, strlen(control->infile) - strlen(control->suffix)); + *(control->outfile + strlen(control->infile) - + strlen(control->suffix)) = '\0'; } fd_in = open(control->infile,O_RDONLY);