Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0ded703

Browse files
Fix memory leak in pg_hmac
The intermittent h buffer was not freed, causing it to leak. Backpatchthrough 14 where HMAC was refactored to the current API.Author: Sergey Shinderuk <s.shinderuk@postgrespro.ru>Discussion:https://postgr.es/m/af07e620-7e28-a742-4637-2bc44aa7c2be@postgrespro.ruBackpatch-through: 14
1 parent8c1144b commit0ded703

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎src/common/hmac.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,22 @@ pg_hmac_final(pg_hmac_ctx *ctx, uint8 *dest, size_t len)
232232
memset(h,0,ctx->digest_size);
233233

234234
if (pg_cryptohash_final(ctx->hash,h,ctx->digest_size)<0)
235+
{
236+
FREE(h);
235237
return-1;
238+
}
236239

237240
/* H(K XOR opad, tmp) */
238241
if (pg_cryptohash_init(ctx->hash)<0||
239242
pg_cryptohash_update(ctx->hash,ctx->k_opad,ctx->block_size)<0||
240243
pg_cryptohash_update(ctx->hash,h,ctx->digest_size)<0||
241244
pg_cryptohash_final(ctx->hash,dest,len)<0)
242245
{
246+
FREE(h);
243247
return-1;
244248
}
245249

250+
FREE(h);
246251
return0;
247252
}
248253

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp