1998-06-27 10:31:18 +00:00
|
|
|
--- pop_msg.c.orig Sat Jun 27 03:09:47 1998
|
1998-06-27 21:47:34 +00:00
|
|
|
+++ pop_msg.c Sat Jun 27 14:35:49 1998
|
1998-06-27 10:31:18 +00:00
|
|
|
@@ -27,6 +27,7 @@
|
|
|
|
{
|
|
|
|
POP * p;
|
|
|
|
int stat; /* POP status indicator */
|
|
|
|
+ int l, len; /* remaining buffer length */
|
|
|
|
char * format; /* Format string for the message */
|
|
|
|
va_list ap;
|
|
|
|
register char * mp;
|
|
|
|
@@ -50,6 +51,7 @@
|
|
|
|
|
|
|
|
/* Point to the message buffer */
|
|
|
|
mp = message;
|
|
|
|
+ len = sizeof(message);
|
|
|
|
|
|
|
|
/* Format the POP status code at the beginning of the message */
|
|
|
|
if (stat == POP_SUCCESS)
|
|
|
|
@@ -58,17 +60,18 @@
|
|
|
|
(void)sprintf (mp,"%s ",POP_ERR);
|
|
|
|
|
|
|
|
/* Point past the POP status indicator in the message message */
|
|
|
|
- mp += strlen(mp);
|
|
|
|
+ l = strlen(mp);
|
|
|
|
+ len -= l, mp += l;
|
|
|
|
|
|
|
|
/* Append the message (formatted, if necessary) */
|
|
|
|
if (format)
|
|
|
|
#ifdef HAVE_VPRINTF
|
|
|
|
- vsprintf(mp,format,ap);
|
1998-06-27 21:47:34 +00:00
|
|
|
+ vsnprintf(mp,len,format,ap);
|
1998-06-27 10:31:18 +00:00
|
|
|
#else
|
|
|
|
# ifdef PYRAMID
|
|
|
|
- (void)sprintf(mp,format, arg1, arg2, arg3, arg4, arg5, arg6);
|
1998-06-27 21:47:34 +00:00
|
|
|
+ (void)snprintf(mp,len,format, arg1, arg2, arg3, arg4, arg5, arg6);
|
1998-06-27 10:31:18 +00:00
|
|
|
# else
|
|
|
|
- (void)sprintf(mp,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2],
|
1998-06-27 21:47:34 +00:00
|
|
|
+ (void)snprintf(mp,len,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2],
|
1998-06-27 10:31:18 +00:00
|
|
|
((int *)ap)[3],((int *)ap)[4]);
|
|
|
|
# endif
|
|
|
|
#endif
|
1998-06-27 21:47:34 +00:00
|
|
|
@@ -87,7 +90,8 @@
|
|
|
|
(p->user ? p->user : "(null)"), p->client, message);
|
|
|
|
|
|
|
|
/* Append the <CR><LF> */
|
|
|
|
- (void)strcat(message, "\r\n");
|
|
|
|
+ len -= strlen(message);
|
1998-06-28 08:04:07 +00:00
|
|
|
+ (void)strncat(message, "\r\n", len);
|
1998-06-27 21:47:34 +00:00
|
|
|
|
|
|
|
/* Send the message to the client */
|
|
|
|
(void)fputs(message,p->output);
|
|
|
|
--- pop_log.c.orig Wed Nov 19 13:20:38 1997
|
|
|
|
+++ pop_log.c Sat Jun 27 14:46:17 1998
|
|
|
|
@@ -47,12 +47,12 @@
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_VPRINTF
|
|
|
|
- vsprintf(msgbuf,format,ap);
|
|
|
|
+ vsnprintf(msgbuf,sizeof msgbuf,format,ap);
|
|
|
|
#else
|
|
|
|
# ifdef PYRAMID
|
|
|
|
- (void)sprintf(msgbuf,format, arg1, arg2, arg3, arg4, arg5, arg6);
|
|
|
|
+ (void)snprintf(msgbuf,sizeof msgbuf,format, arg1, arg2, arg3, arg4, arg5, arg6);
|
|
|
|
# else
|
|
|
|
- (void)sprintf (msgbuf,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2],
|
|
|
|
+ (void)snprintf (msgbuf,sizeof msgbuf,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2],
|
|
|
|
((int *)ap)[3],((int *)ap)[4],((int *)ap)[5]);
|
|
|
|
# endif
|
|
|
|
va_end(ap);
|