$NetBSD: patch-ai,v 1.1 2004/02/25 03:58:43 snj Exp $ --- metamail/metamail.c.orig 1994-02-16 17:57:19.000000000 -0800 +++ metamail/metamail.c 2004-02-24 10:47:27.000000000 -0800 @@ -83,7 +83,7 @@ extern char *MkRmScript(); #define MAX_FILE_NAME_SIZE 256 #define WRITE_BINARY "w" #else /* AMIGA */ -extern char **environ, *gets(); +extern char **environ; #define CATCOMMAND "cat" #define CATTEMPLATE "cat %s" #define METAMAIL "metamail" @@ -579,7 +579,7 @@ int nestingdepth; int overwriteans = -1; do { printf("File %s exists. Do you want to overwrite it (y/n) ?\n", Fname); - s = gets(AnsBuf); + s = fgets(AnsBuf, sizeof(AnsBuf), stdin); if (!s) { overwriteans = 0; } else { @@ -1202,9 +1202,9 @@ char *SquirrelFile; fprintf(outfp, "Content-type: %s", ContentType); for (j=0; j<CParamsUsed; ++j) { fprintf(outfp, " ; "); - fprintf(outfp, CParams[j]); + fprintf(outfp, "%s", CParams[j]); fprintf(outfp, " = "); - fprintf(outfp, CParamValues[j]); + fprintf(outfp, "%s", CParamValues[j]); } fprintf(outfp, "\n\n"); TranslateInputToOutput(InputFP, outfp, EncodingCode, ContentType); @@ -1823,7 +1823,7 @@ char *ctype, *progname, *label; } else { printf("This message contains '%s'-format data.\nDo you want to view it using the '%s' command (y/n) [y] ? ", ctype, ShortCommand(progname)); } - s = gets(AnsBuf); + s = fgets(AnsBuf, sizeof(AnsBuf), stdin); if (!s) return(0); /* EOF */ while (s && *s && isspace((unsigned char) *s)) ++s; if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') return(1); @@ -2022,7 +2022,8 @@ int ShowLeadingWhitespace; if (lc2strcmp(charset, PrevCharset)) { char *s2, *charsetinuse; - strcpy(PrevCharset, charset); + strncpy(PrevCharset, charset, sizeof(PrevCharset)); + PrevCharset[sizeof(PrevCharset) - 1] = '\0'; for (s2=PrevCharset; *s2; ++s2) { if (isupper((unsigned char) *s2)) *s2 = tolower((unsigned char) *s2); } @@ -2032,7 +2033,7 @@ int ShowLeadingWhitespace; } } if (ecode == ENCODING_NONE) { - printf(txt+1); + printf("%s", txt+1); } else { /* What follows is REALLY bogus, but all my encoding stuff is pipe-oriented right now... */ MkTmpFileName(TmpFile);