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

Commit2f31414

Browse files
committed
Fix memory leak when rejecting bogus DH parameters.
While back-patchinge0e569e, I noted that there were some otherplaces where we ought to be applying DH_free(); namely, where weload some DH parameters from a file and then reject them as notbeing sufficiently secure. While it seems really unlikely thatanybody would hit these code paths in production, let alone doso repeatedly, let's fix it for consistency.Back-patch to v10 where this code was introduced.Discussion:https://postgr.es/m/16160-18367e56e9a28264@postgresql.org
1 parent992cba9 commit2f31414

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎src/backend/libpq/be-secure-openssl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,13 +850,15 @@ load_dh_file(char *filename, bool isServerStart)
850850
(errcode(ERRCODE_CONFIG_FILE_ERROR),
851851
errmsg("invalid DH parameters: %s",
852852
SSLerrmessage(ERR_get_error()))));
853+
DH_free(dh);
853854
returnNULL;
854855
}
855856
if (codes&DH_CHECK_P_NOT_PRIME)
856857
{
857858
ereport(isServerStart ?FATAL :LOG,
858859
(errcode(ERRCODE_CONFIG_FILE_ERROR),
859860
errmsg("invalid DH parameters: p is not prime")));
861+
DH_free(dh);
860862
returnNULL;
861863
}
862864
if ((codes&DH_NOT_SUITABLE_GENERATOR)&&
@@ -865,6 +867,7 @@ load_dh_file(char *filename, bool isServerStart)
865867
ereport(isServerStart ?FATAL :LOG,
866868
(errcode(ERRCODE_CONFIG_FILE_ERROR),
867869
errmsg("invalid DH parameters: neither suitable generator or safe prime")));
870+
DH_free(dh);
868871
returnNULL;
869872
}
870873

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp