]> git.puffer.fish Git - matthieu/frr.git/commit
lib: fix _hash_member() crash w/ empty hash
authorDavid Lamparter <equinox@opensourcerouting.org>
Fri, 21 Apr 2023 14:23:39 +0000 (16:23 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 21 Apr 2023 14:30:32 +0000 (16:30 +0200)
commit5523a505f4bd6ce57f951ccb0cc7b9b29a963d7c
treed72b5165b99b42f6d2831d11351ad88f0cd2a118
parentae19023b8e00c6a8d4ae9d631d8db15fb4924800
lib: fix _hash_member() crash w/ empty hash

The typesafe hash _member() didn't check tabshift/count before
proceeding to look at the hash table, leading it to dereference a NULL
pointer when the hash table is in fact empty.

Test case added to tests/lib/test_typelist.

Note this function is not currently used anywhere.  Only lib/cspf.c uses
_member(), but it does so on a RB-tree rather than a hash.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/typesafe.h
tests/lib/test_typelist.h