Re: Segmentation fault in netstat after r354373 -> r354373 update

From: David Wolfskill <david_at_catwhisker.org>
Date: Thu, 7 Nov 2019 07:15:30 -0800
On Thu, Nov 07, 2019 at 04:08:28PM +0100, Arnaud Ysmal wrote:
> Hi,
> 
> I just got the same issue, it happens when argv[0] does not contain a / 
> (calling uptime segfault but calling /usr/bin/uptime works).
> 
> In xo_parse_args there is no check whether cp is NULL before calling 
> xo_streq.
> 
> I fixed it by changing this line:
> -       cp = &cp[len + 1 - sizeof(gnu_ext)];
> +       cp = (char *)(uintptr_t)(const char *)(&xo_program[len + 1 - 
> sizeof(gnu_ext)]);
> 
> Arnaud Ysmal

Ah!  Excellent analysis: thank you! :-)

Peace,
david

-- 
David H. Wolfskill				david_at_catwhisker.org
It's ... rich ... for Trump to accuse someone else of being a liar.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.

Received on Thu Nov 07 2019 - 14:15:33 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:22 UTC