Nico Golde wrote:
> Package: screen
> Version: 4.0.2-4.1
> Severity: wishlist
> Tags: patch
> Hi,
> screen isn't able to handle ~/ if you want to load a
> configuration file via source in the command line.
> I hate this because it is short and good :)
> However, I attached a patch which fixes this.
> Please include it.

Please don't.

At least not literally.

> +  char *tmp_file, *tmp_rcname;
>    if (rc_recursion > 10)
>      {
>        Msg(0, "%s: source: recursion limit reached", rc_name);
>        return;
>      }
>    rc_recursion++;
> -  FinishRc(rcfilename);
> +  if (rcfilename[0]=='~' && rcfilename[1]=='/')
> +  {
> +    tmp_file=getenv("HOME");

getenv() can return NULL

Better use something like "if ((tmp_file=getenv("HOME")) != NULL) {"

> +    strncat(tmp_file,"/",1);

Ouch!  Never concat *anything* to a forignly allocated string!
Never ever!

Create a new variable of the proper size (i.e. strlen(tmp_file)+2)
and use that.

> +    tmp_rcname=strtok(rcfilename,"~/");

Again, strtok() can return NULL.

> +    strncat(tmp_file,tmp_rcname, strlen(tmp_rcname));

Ouch!  See my comment above.

Regards,

        Joey

-- 
Everybody talks about it, but nobody does anything about it!  -- Mark Twain

Please always Cc to me when replying to me on the lists.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to