Replace gets() with fgets()
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <signal.h>
|
||||
#include "c-client.h"
|
||||
#include "imap4r1.h"
|
||||
#include <string.h>
|
||||
|
||||
/* 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,".");
|
||||
|
||||
Reference in New Issue
Block a user