Re: bsdtar core dumps

From: Giorgos Keramidas <keramida_at_ceid.upatras.gr>
Date: Tue, 24 Aug 2004 23:49:17 +0300
Hi Sean,

Does the patch below also solve the problems with tar you were
experiencing?

On 2004-08-24 13:03, Sean McNeil <sean_at_mcneil.com> wrote:
> *** lib/libarchive/archive_string_sprintf.c.orig        Fri Aug 13
> 20:45:45 2004--- lib/libarchive/archive_string_sprintf.c     Tue Aug 24
> 12:58:24 2004
> *************** __archive_string_vsprintf(struct archive
> *** 47,65 ****
>       va_list ap)
>   {
>         size_t l;
> 
>         if (fmt == NULL) {
>                 as->s[0] = 0;
>                 return;
>         }
> 
>         l = vsnprintf(as->s, as->buffer_length, fmt, ap);
>         /* If output is bigger than the buffer, resize and try again. */
>         if (l+1 >= as->buffer_length) {
>                 __archive_string_ensure(as, l + 1);
> !               l = vsnprintf(as->s, as->buffer_length, fmt, ap);
>         }
>         as->length = l;
>   }
> 
>   /*
> --- 47,68 ----
>       va_list ap)
>   {
>         size_t l;
> +       va_list ap1;
> 
>         if (fmt == NULL) {
>                 as->s[0] = 0;
>                 return;
>         }
> 
> +       va_copy(ap1,ap);
>         l = vsnprintf(as->s, as->buffer_length, fmt, ap);
>         /* If output is bigger than the buffer, resize and try again. */
>         if (l+1 >= as->buffer_length) {
>                 __archive_string_ensure(as, l + 1);
> !               l = vsnprintf(as->s, as->buffer_length, fmt, ap1);
>         }
>         as->length = l;
> +       va_end(ap1);
>   }
> 
>   /*
> 
> *** lib/libc/stdio/vfprintf.c.orig      Mon Aug 23 20:35:43 2004
> --- lib/libc/stdio/vfprintf.c   Tue Aug 24 13:01:45 2004
> *************** error:
> *** 1237,1242 ****
> --- 1237,1243 ----
>         if (dtoaresult != NULL)
>                 freedtoa(dtoaresult);
>   #endif
> +       va_end(orgap);
>         if (convbuf != NULL)
>                 free(convbuf);
>         if (__sferror(fp))
> 
Received on Tue Aug 24 2004 - 18:50:52 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:08 UTC