diff --git a/src/mtest/mtest.c b/src/mtest/mtest.c index 69af568..c15a853 100644 --- a/src/mtest/mtest.c +++ b/src/mtest/mtest.c @@ -38,6 +38,7 @@ #include #include "c-client.h" #include "imap4r1.h" +#include /* Excellent reasons to hate ifdefs, and why my real code never uses them */ @@ -595,7 +596,8 @@ void status (MAILSTREAM *stream) void prompt (char *msg,char *txt) { printf ("%s",msg); - gets (txt); + if (!fgets (txt, sizeof (txt), stdin)) txt[0] = '\0'; + txt[strcspn (txt, "\r\n")] = '\0'; } /* Interfaces to C-client */ @@ -779,7 +781,8 @@ void smtptest (long debug) puts (" Msg (end with a line with only a '.'):"); body->type = TYPETEXT; *text = '\0'; - while (gets (line)) { + while (fgets (line, sizeof (line), stdin)) { + line[strcspn (line, "\r\n")] = '\0'; if (line[0] == '.') { if (line[1] == '\0') break; else strcat (text,".");