Segmentation fault in netstat after r354373 -> r354373 update

David Wolfskill david at catwhisker.org
Thu Nov 7 15:15:33 UTC 2019


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 618 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20191107/9c6e4b98/attachment.sig>


More information about the freebsd-current mailing list