The intermittent h buffer was not freed, causing it to leak. Backpatch
through 14 where HMAC was refactored to the current API.
Author: Sergey Shinderuk <
[email protected]>
Discussion: https://postgr.es/m/
af07e620-7e28-a742-4637-
2bc44aa7c2be@postgrespro.ru
Backpatch-through: 14
memset(h, 0, ctx->digest_size);
if (pg_cryptohash_final(ctx->hash, h, ctx->digest_size) < 0)
+ {
+ FREE(h);
return -1;
+ }
/* H(K XOR opad, tmp) */
if (pg_cryptohash_init(ctx->hash) < 0 ||
pg_cryptohash_update(ctx->hash, h, ctx->digest_size) < 0 ||
pg_cryptohash_final(ctx->hash, dest, len) < 0)
{
+ FREE(h);
return -1;
}
+ FREE(h);
return 0;
}