Hi Neel,
Neel Chauhan wrote on Tue, Aug 29, 2023 at 02:36:57PM -0700:
> On 2023-08-29 14:23, Theo Buehler wrote:
>> Neel Chauhan:
>>> + if (string[strlen(string) - 1] == '.')
>>> + buf[strlen(string) - 1] = '\0';
>> Careful with out-of-bounds accesses. What if string is "" ? Probably
On 2023-08-29 14:23, Theo Buehler wrote:
+ if (string[strlen(string) - 1] == '.')
+ buf[strlen(string) - 1] = '\0';
Careful with out-of-bounds accesses. What if string is "" ? Probably
easiest to do "len = strlen(string);" and if (len > 0 && ...).
Good catch!
Does this lo
> + if (string[strlen(string) - 1] == '.')
> + buf[strlen(string) - 1] = '\0';
Careful with out-of-bounds accesses. What if string is "" ? Probably
easiest to do "len = strlen(string);" and if (len > 0 && ...).
Hi,
I don't know if this is a big issue for you, but when
doing a `sysctl` call with a trailing period ("."),
like `sysctl kern.`, I get an error like this:
sysctl: second level name in kern. is invalid
On other systems, if I do `sysctl XX.`, I get all the
entries inside XX. We should fix it