Extend sshbuf validation
authortobias <tobias@openbsd.org>
Wed, 14 Aug 2024 15:40:30 +0000 (15:40 +0000)
committertobias <tobias@openbsd.org>
Wed, 14 Aug 2024 15:40:30 +0000 (15:40 +0000)
commit2afef00e724a2c816f2f2ac10fcb2ac7e824afbc
treef1f441f75ccc04d0029ad11cb86fbf6c576e025f
parent413e8297772947bb0acb2230f1bc73c90c31d3ce
Extend sshbuf validation

Multiple sshbuf structs can be linked through a parent/child relationship.
Make sure that a single sshbuf cannot be its own parent. If this would ever
happen, it would result in reference counting issues.

This is a cheap way of testing this with very little overhead. It does not
detect A->B->A linkages though for performance reason and the fact that it
takes a programming error for this to occur anyway.

Authored with Benny Baumann (BenBE at geshi dot org).

ok djm@
usr.bin/ssh/sshbuf.c