From 69033375d8c01856b6a92652518356bab03e44f1 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 2 Apr 1997 18:07:51 +0000 Subject: Fix YA error.c problem. svn path=/trunk/; revision=943 --- NEWS | 8 ++++++-- report.c | 29 +++++++++++++++++------------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index b8c21c26..63144409 100644 --- a/NEWS +++ b/NEWS @@ -16,7 +16,7 @@ features -- * It is now possible to set a default poll interval with `set daemon'. -* -U option to force UIDL use under POP3 (thanks, Ingmar Baumgart). +* -U/uidl option to force UIDL use under POP3 (thanks, Ingmar Baumgart). bugs -- @@ -29,7 +29,11 @@ bugs -- * --nowrewrite was a no-op. Fixed. -There are 261 people on the fetchmail-friends list. +* Fetchmail was aborting with "partial message buffer overflow" on Suns + due to unreliable vsprintf return. This has been fixed with changes + to error.c. + +There are 268 people on the fetchmail-friends list. ------------------------------------------------------------------------------ fetchmail-3.8 (Fri Mar 7 17:34:02 EST 1997) diff --git a/report.c b/report.c index c9aa0a63..ee7d7594 100644 --- a/report.c +++ b/report.c @@ -17,6 +17,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by David MacKenzie . * Heavily modified by Dave Bodenstab and ESR. + * Bludgeoned into submission for SunOS 4.1.3 by + * Chris Cheyney . + * Now it works even when the return from vprintf is unreliable. */ #ifdef HAVE_CONFIG_H @@ -269,13 +272,13 @@ error_build (message, va_alist) if (partial_message_size == 0) { partial_message_size_used = 0; - partial_message_size = 512; + partial_message_size = 2048; partial_message = xmalloc (partial_message_size); } else - if (partial_message_size - partial_message_size_used < 256) + if (partial_message_size - partial_message_size_used < 1024) { - partial_message_size += 512; + partial_message_size += 2048; partial_message = xrealloc (partial_message, partial_message_size); } @@ -294,11 +297,12 @@ error_build (message, va_alist) break; } - partial_message_size += 512; + partial_message_size += 2048; partial_message = xrealloc (partial_message, partial_message_size); } #else - partial_message_size_used += vsprintf (partial_message + partial_message_size_used, message, args); + vsprintf (partial_message + partial_message_size_used, message, args); + partial_message_size_used += strlen(partial_message+partial_message_size_used); /* Attempt to catch memory overwrites... */ if (partial_message_size_used >= partial_message_size) @@ -322,7 +326,7 @@ error_build (message, va_alist) break; } - partial_message_size += 512; + partial_message_size += 2048; partial_message = xrealloc (partial_message, partial_message_size); } #else @@ -370,13 +374,13 @@ error_complete (status, errnum, message, va_alist) if (partial_message_size == 0) { partial_message_size_used = 0; - partial_message_size = 512; + partial_message_size = 2048; partial_message = xmalloc (partial_message_size); } else - if (partial_message_size - partial_message_size_used < 256) + if (partial_message_size - partial_message_size_used < 1024) { - partial_message_size += 512; + partial_message_size += 2048; partial_message = xrealloc (partial_message, partial_message_size); } @@ -395,11 +399,12 @@ error_complete (status, errnum, message, va_alist) break; } - partial_message_size += 512; + partial_message_size += 2048; partial_message = xrealloc (partial_message, partial_message_size); } #else - partial_message_size_used += vsprintf (partial_message + partial_message_size_used, message, args); + vsprintf (partial_message + partial_message_size_used, message, args); + partial_message_size_used += strlen(partial_message+partial_message_size_used); /* Attempt to catch memory overwrites... */ if (partial_message_size_used >= partial_message_size) @@ -423,7 +428,7 @@ error_complete (status, errnum, message, va_alist) break; } - partial_message_size += 512; + partial_message_size += 2048; partial_message = xrealloc (partial_message, partial_message_size); } #else -- cgit v1.2.3