Don't use `static char buffer[512]' in pop3d_readline.
Showing
4 changed files
with
16 additions
and
15 deletions
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. |
3 | 3 | ||
4 | GNU Mailutils is free software; you can redistribute it and/or modify | 4 | GNU Mailutils is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with GNU Mailutils; if not, write to the Free Software | 15 | along with GNU Mailutils; if not, write to the Free Software |
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
17 | 17 | ||
18 | #include "pop3d.h" | 18 | #include "pop3d.h" |
19 | 19 | ||
... | @@ -151,17 +151,16 @@ pop3d_outf (const char *fmt, ...) | ... | @@ -151,17 +151,16 @@ pop3d_outf (const char *fmt, ...) |
151 | 151 | ||
152 | /* Gets a line of input from the client, caller should free() */ | 152 | /* Gets a line of input from the client, caller should free() */ |
153 | char * | 153 | char * |
154 | pop3d_readline (FILE *fp) | 154 | pop3d_readline (char *buffer, int size) |
155 | { | 155 | { |
156 | static char buffer[512]; | ||
157 | char *ptr; | 156 | char *ptr; |
158 | 157 | ||
159 | alarm (daemon_param.timeout); | 158 | alarm (daemon_param.timeout); |
160 | ptr = fgets (buffer, sizeof (buffer), fp); | 159 | ptr = fgets (buffer, size, ifile); |
161 | alarm (0); | 160 | alarm (0); |
162 | 161 | ||
163 | /* We should probably check ferror() too, but if ptr is null we | 162 | /* We should probably check ferror() too, but if ptr is null we |
164 | are done anyway; if (!ptr && ferror(fp)) */ | 163 | are done anyway; if (!ptr && ferror(ifile)) */ |
165 | if (!ptr) | 164 | if (!ptr) |
166 | pop3d_abquit (ERR_NO_OFILE); | 165 | pop3d_abquit (ERR_NO_OFILE); |
167 | 166 | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
3 | 3 | ||
4 | GNU Mailutils is free software; you can redistribute it and/or modify | 4 | GNU Mailutils is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with GNU Mailutils; if not, write to the Free Software | 15 | along with GNU Mailutils; if not, write to the Free Software |
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
17 | 17 | ||
18 | #include "pop3d.h" | 18 | #include "pop3d.h" |
19 | 19 | ||
... | @@ -201,6 +201,7 @@ static int | ... | @@ -201,6 +201,7 @@ static int |
201 | pop3d_mainloop (int infile, int outfile) | 201 | pop3d_mainloop (int infile, int outfile) |
202 | { | 202 | { |
203 | int status = OK; | 203 | int status = OK; |
204 | char buffer[512]; | ||
204 | 205 | ||
205 | /* Reset hup to exit. */ | 206 | /* Reset hup to exit. */ |
206 | signal (SIGHUP, pop3d_signal); | 207 | signal (SIGHUP, pop3d_signal); |
... | @@ -269,7 +270,7 @@ pop3d_mainloop (int infile, int outfile) | ... | @@ -269,7 +270,7 @@ pop3d_mainloop (int infile, int outfile) |
269 | 270 | ||
270 | fflush (ofile); | 271 | fflush (ofile); |
271 | status = OK; | 272 | status = OK; |
272 | buf = pop3d_readline (ifile); | 273 | buf = pop3d_readline (buffer, sizeof (buffer)); |
273 | cmd = pop3d_cmd (buf); | 274 | cmd = pop3d_cmd (buf); |
274 | arg = pop3d_args (buf); | 275 | arg = pop3d_args (buf); |
275 | 276 | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
3 | 3 | ||
4 | GNU Mailutils is free software; you can redistribute it and/or modify | 4 | GNU Mailutils is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with GNU Mailutils; if not, write to the Free Software | 15 | along with GNU Mailutils; if not, write to the Free Software |
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
17 | 17 | ||
18 | #ifndef _POP3D_H | 18 | #ifndef _POP3D_H |
19 | #define _POP3D_H 1 | 19 | #define _POP3D_H 1 |
... | @@ -189,7 +189,7 @@ extern int pop3d_list __P ((const char *)); | ... | @@ -189,7 +189,7 @@ extern int pop3d_list __P ((const char *)); |
189 | extern int pop3d_lock __P ((void)); | 189 | extern int pop3d_lock __P ((void)); |
190 | extern int pop3d_noop __P ((const char *)); | 190 | extern int pop3d_noop __P ((const char *)); |
191 | extern int pop3d_quit __P ((const char *)); | 191 | extern int pop3d_quit __P ((const char *)); |
192 | extern char *pop3d_readline __P ((FILE *)); | 192 | extern char *pop3d_readline __P ((char *, int)); |
193 | extern int pop3d_retr __P ((const char *)); | 193 | extern int pop3d_retr __P ((const char *)); |
194 | extern int pop3d_rset __P ((const char *)); | 194 | extern int pop3d_rset __P ((const char *)); |
195 | extern RETSIGTYPE pop3d_sigchld __P ((int)); | 195 | extern RETSIGTYPE pop3d_sigchld __P ((int)); | ... | ... |
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. |
3 | 3 | ||
4 | GNU Mailutils is free software; you can redistribute it and/or modify | 4 | GNU Mailutils is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with GNU Mailutils; if not, write to the Free Software | 15 | along with GNU Mailutils; if not, write to the Free Software |
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
17 | 17 | ||
18 | #include "pop3d.h" | 18 | #include "pop3d.h" |
19 | 19 | ||
... | @@ -21,6 +21,7 @@ int | ... | @@ -21,6 +21,7 @@ int |
21 | pop3d_user (const char *arg) | 21 | pop3d_user (const char *arg) |
22 | { | 22 | { |
23 | char *buf, pass[POP_MAXCMDLEN], *tmp, *cmd; | 23 | char *buf, pass[POP_MAXCMDLEN], *tmp, *cmd; |
24 | char buffer[512]; | ||
24 | int status; | 25 | int status; |
25 | int lockit = 1; | 26 | int lockit = 1; |
26 | struct mu_auth_data *auth_data; | 27 | struct mu_auth_data *auth_data; |
... | @@ -34,7 +35,7 @@ pop3d_user (const char *arg) | ... | @@ -34,7 +35,7 @@ pop3d_user (const char *arg) |
34 | pop3d_outf ("+OK\r\n"); | 35 | pop3d_outf ("+OK\r\n"); |
35 | fflush (ofile); | 36 | fflush (ofile); |
36 | 37 | ||
37 | buf = pop3d_readline (ifile); | 38 | buf = pop3d_readline (buffer, sizeof (buffer)); |
38 | cmd = pop3d_cmd (buf); | 39 | cmd = pop3d_cmd (buf); |
39 | tmp = pop3d_args (buf); | 40 | tmp = pop3d_args (buf); |
40 | 41 | ... | ... |
-
Please register or sign in to post a comment