Hrvoje Niksic <[EMAIL PROTECTED]> writes:

> The code in question is:
>
>   if (!hs->local_file)     
>     {
>       if (resp_header_copy (resp, "Content-Disposition", hdrval, sizeof 
> (hdrval)))
>         /* Honor Content-Disposition. */
>         {
>           hs->local_file = xstrdup (hdrval);
>         }
>       else
>         /* Choose filename according to URL name. */
>         {
>           hs->local_file = url_file_name (u);
>         }
>     }

I now see that this code has more serious problems than not parsing
Content-Disposition correctly.  Specifically:

* The local name is copied from the header verbatim without inspecting
  it for dangerous characters, such as "/" (on Windows also "\").

* There seems to be no code to check for uniqueness of file name.  So
  far Wget's philosophy has been not to overwrite file names by
  default.  If this is being changed, some people will be confused...
  and it leaves too much room for abuse.

* Now that the local name is determined and printed after the headers
  have been received, shouldn't we remove the "local file has sprung
  to existence" kludge?  (See http://tinyurl.com/7b69q for details
  about it.)

Reply via email to