Theo Buehler <t...@theobuehler.org> wrote:

> On Thu, Jul 20, 2023 at 05:06:00PM +0200, Claudio Jeker wrote:
> > I think it is better to use a safe ideom when matching against a peer name
> > instead of forcefully NUL terminate the string somewhere unrelated.
> > By default all these string buffers use the same size so strncmp() will
> > not clip since the peer description is enforced by bgpd to be smaller.
> >
> > Another option would be to move
> >     neighbor->descr[PEER_DESCR_LEN - 1] = 0;
> > into the match functions. At least then it is certainly done.
> 
> I prefer strncpy(). So this diff is ok.

The problem with strncpy() is increasing number of people eyeing it with
prejudice and therefore a temptation to "fix it", and move the NUL.  It
could happen in the future, I would entertain making 20 year bets...

Reply via email to