Skip to content

libdnssec/key: bad logic leaves key with dangling pointer

Ghost User requested to merge dnssec-undefined-memory into master

How to reproduce:

  1. a copy of binary data struct is made at L439

  2. that struct is then resized to accomodate for new key. If successful, new_rdata points to resized memory, key->rdata points to previous location.

  3. creating pubkey at L446 fails and function returns, key->rdata is still invalid

  4. further using key causes use-after-free, freeing double-free freeing key causes double-free and using it use-after-free

Merge request reports