Commit 9df95217 9df95217e34ae81416788997d931f45f29df1f45 by Wojciech Polak

Don't use `static char buffer[512]' in pop3d_readline.

1 parent 945833ab
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "pop3d.h"
......@@ -151,17 +151,16 @@ pop3d_outf (const char *fmt, ...)
/* Gets a line of input from the client, caller should free() */
char *
pop3d_readline (FILE *fp)
pop3d_readline (char *buffer, int size)
{
static char buffer[512];
char *ptr;
alarm (daemon_param.timeout);
ptr = fgets (buffer, sizeof (buffer), fp);
ptr = fgets (buffer, size, ifile);
alarm (0);
/* We should probably check ferror() too, but if ptr is null we
are done anyway; if (!ptr && ferror(fp)) */
are done anyway; if (!ptr && ferror(ifile)) */
if (!ptr)
pop3d_abquit (ERR_NO_OFILE);
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "pop3d.h"
......@@ -201,6 +201,7 @@ static int
pop3d_mainloop (int infile, int outfile)
{
int status = OK;
char buffer[512];
/* Reset hup to exit. */
signal (SIGHUP, pop3d_signal);
......@@ -269,7 +270,7 @@ pop3d_mainloop (int infile, int outfile)
fflush (ofile);
status = OK;
buf = pop3d_readline (ifile);
buf = pop3d_readline (buffer, sizeof (buffer));
cmd = pop3d_cmd (buf);
arg = pop3d_args (buf);
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _POP3D_H
#define _POP3D_H 1
......@@ -189,7 +189,7 @@ extern int pop3d_list __P ((const char *));
extern int pop3d_lock __P ((void));
extern int pop3d_noop __P ((const char *));
extern int pop3d_quit __P ((const char *));
extern char *pop3d_readline __P ((FILE *));
extern char *pop3d_readline __P ((char *, int));
extern int pop3d_retr __P ((const char *));
extern int pop3d_rset __P ((const char *));
extern RETSIGTYPE pop3d_sigchld __P ((int));
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "pop3d.h"
......@@ -21,6 +21,7 @@ int
pop3d_user (const char *arg)
{
char *buf, pass[POP_MAXCMDLEN], *tmp, *cmd;
char buffer[512];
int status;
int lockit = 1;
struct mu_auth_data *auth_data;
......@@ -34,7 +35,7 @@ pop3d_user (const char *arg)
pop3d_outf ("+OK\r\n");
fflush (ofile);
buf = pop3d_readline (ifile);
buf = pop3d_readline (buffer, sizeof (buffer));
cmd = pop3d_cmd (buf);
tmp = pop3d_args (buf);
......