[hackers] Re: [sent][PATCH] Avoid out-of-bounds access when a slide input line begins with \0

From: Chris Down <chris_AT_chrisdown.name>
Date: Wed, 13 May 2020 12:18:01 +0100

Hiltjo Posthuma writes:
>Looks good to me, minor nitpick, maybe the style can be:
>
> if (buf[0] == '\0')

Sure, either style is fine with me. I'll send v2 now. :-)

>and maybe fgets can simply be rewritten using getline() at:
>
> http://git.suckless.org/sent/file/sent.c.html#l417

Hmm, unless I'm missing something, getline() actually would hinder here since
we need to use separate heap storage for each line, but getline() optimises for
the case where `char **lineptr` can be reused for each line. As such we'd still
have to strdup(), or entries in s->lines would always end up being the same.
Received on Wed May 13 2020 - 13:18:01 CEST

This archive was generated by hypermail 2.3.0 : Wed May 13 2020 - 13:24:38 CEST