wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Wget-dev] wget2 | Fix progress display (issue #339) (!391)


From: Josef Möllers
Subject: Re: [Wget-dev] wget2 | Fix progress display (issue #339) (!391)
Date: Fri, 17 Aug 2018 08:48:28 +0000

Josef Möllers commented on a discussion on libwget/bar.c:

>       _bar_slot_t *slotp = &bar->slots[slot];
>  
>       xfree(slotp->filename);
> -     slotp->filename = wget_strdup(filename);
> +     if (++slotp->numfiles == 1) {
> +         slotp->filename = wget_strdup(filename);
> +         slotp->bytes_downloaded = 0;
> +     } else {
> +         char tag[128];

snprintf must be passed the size of the destination buffer (as the second 
argument)  and it will truncate the result to that size.
But I beg to differ: "slotp->filename = wget_strdup(filename);", so this is 
only as big as "filename" which may be too small (in extreme cases). I try to 
keep the string as big as it can get and leave the truncating to later 
functions. After all: "wget_strdup(filename)" will create a string as long as 
the filename which may be VERY long at times.

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/merge_requests/391#note_95082259
You're receiving this email because of your account on gitlab.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]