Hi Simon,

The gc_hash_clone function, as defined in lib/gc-libgcrypt.c, has a strange API:
If it fails with return code GC_INVALID_HASH, it sets *outhandle to a free()d
memory pointer.

That could lead to a double-free error if the caller were to free(*outhandle)
when *outhandle has changed.

The only user of this function that I can see is
gnutls/lib/gnutls_hash_int.c, and it fortunately does not have a bug.

Nevertheless, what do you think about leaving *outhandle unset upon failure?

Bruno




  • gc_hash_clone Bruno Haible via Gnulib discussion list

Reply via email to