Looks cleaner than the unconst. Le 7 novembre 2019 16:40:04 GMT+01:00, Phil Shafer <phil_at_juniper.net> a écrit : >+++ b/libxo/libxo.c >_at__at_ -8104,6 +8104,8 _at__at_ xo_parse_args (int argc, char **argv) > cp = strrchr(xo_program, '/'); > if (cp) > xo_program = ++cp; >+ else >+ cp = argv[0]; /* Reset to front of string */ > > /* GNU tools add an annoying ".test" as the program extension; >remove it */ > size_t len = strlen(xo_program); > >On 7 Nov 2019, at 10:08, 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 Arnaud YsmalReceived on Thu Nov 07 2019 - 15:03:35 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:22 UTC