Hi Stefan,

Stefan Sperling wrote on Tue, Nov 05, 2013 at 01:56:33PM +0100:

> Do others think this useful? I hit this because I made copy/paste errors.

Useful?  I don't know.  Maybe, maybe not.

But your patch is NOT OK.

Try stuff like

  $ ftp '  foo' bar

I would be surprised if you couldn't get it to segfault.

  1081:  url = strdup(argv[argpos]);
  1086:  url++;
  1073:  free(url);

is not a great idiom, imho.

Yours,
  Ingo


> Index: fetch.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/ftp/fetch.c,v
> retrieving revision 1.110
> diff -u -p -r1.110 fetch.c
> --- fetch.c   27 Oct 2013 18:31:24 -0000      1.110
> +++ fetch.c   28 Oct 2013 11:57:32 -0000
> @@ -1082,6 +1082,9 @@ auto_fetch(int argc, char *argv[], char 
>               if (url == NULL)
>                       errx(1, "Can't allocate memory for auto-fetch.");
>  
> +             while (isspace(*url))
> +                     url++;
> +
>               /*
>                * Try HTTP URL-style arguments first.
>                */
> 

Reply via email to