diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-03-07 14:32:43 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-03-07 14:32:43 +0000 |
commit | 9ff30b595fcce9126cb44c155449aa218fdcefc7 (patch) | |
tree | a3a27e8d55e6219f161aaf2d272d5fb43b9e99e4 /report.c | |
parent | 3a86e7e6d5137d352ea61ce10c799632d21ab7d2 (diff) | |
download | fetchmail-9ff30b595fcce9126cb44c155449aa218fdcefc7.tar.gz fetchmail-9ff30b595fcce9126cb44c155449aa218fdcefc7.tar.bz2 fetchmail-9ff30b595fcce9126cb44c155449aa218fdcefc7.zip |
Ready for the UIDL patch.
svn path=/trunk/; revision=918
Diffstat (limited to 'report.c')
-rw-r--r-- | report.c | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -279,8 +279,9 @@ error_build (message, va_alist) partial_message = xrealloc (partial_message, partial_message_size); } -#if defined(VA_START) && (HAVE_VSNPRINTF || _LIBC) +#if defined(VA_START) VA_START (args, message); +#if HAVE_VSNPRINTF || _LIBC for ( ; ; ) { n = vsnprintf (partial_message + partial_message_size_used, @@ -296,6 +297,16 @@ error_build (message, va_alist) partial_message_size += 512; partial_message = xrealloc (partial_message, partial_message_size); } +#else + partial_message_size_used += vsprintf (partial_message + partial_message_size_used, message, args); + + /* Attempt to catch memory overwrites... */ + if (partial_message_size_used >= partial_message_size) + { + partial_message_size_used = 0; + error (PS_UNDEFINED, 0, "partial error message buffer overflow"); + } +#endif va_end (args); #else #if HAVE_SNPRINTF @@ -369,8 +380,9 @@ error_complete (status, errnum, message, va_alist) partial_message = xrealloc (partial_message, partial_message_size); } -#if defined(VA_START) && (HAVE_VSNPRINTF || _LIBC) +#if defined(VA_START) VA_START (args, message); +#if HAVE_VSNPRINTF || _LIBC for ( ; ; ) { n = vsnprintf (partial_message + partial_message_size_used, @@ -386,6 +398,16 @@ error_complete (status, errnum, message, va_alist) partial_message_size += 512; partial_message = xrealloc (partial_message, partial_message_size); } +#else + partial_message_size_used += vsprintf (partial_message + partial_message_size_used, message, args); + + /* Attempt to catch memory overwrites... */ + if (partial_message_size_used >= partial_message_size) + { + partial_message_size_used = 0; + error (PS_UNDEFINED, 0, "partial error message buffer overflow"); + } +#endif va_end (args); #else #if HAVE_SNPRINTF |