[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:47:04 +0100

Chris Down writes:
>>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.

Oh, I think I see what you mean now. :-)

Patch attached, not sure it's simpler though since it requires all this futzing
around with buf and n.

Received on Wed May 13 2020 - 13:47:04 CEST

This archive was generated by hypermail 2.3.0 : Wed May 13 2020 - 13:48:42 CEST