Content-Length: 283893 | pFad | http://github.com/postgrespro/postgres/commit/e835e89a0fd267871e7fbddc39ad00ee3d0cb55c

6A Fix memory leak when rejecting bogus DH parameters. · postgrespro/postgres@e835e89 · GitHub
Skip to content

Commit e835e89

Browse files
committed
Fix memory leak when rejecting bogus DH parameters.
While back-patching e0e569e, I noted that there were some other places where we ought to be applying DH_free(); namely, where we load some DH parameters from a file and then reject them as not being sufficiently secure. While it seems really unlikely that anybody would hit these code paths in production, let alone do so 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 parent f0c2a5b commit e835e89

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
@@ -922,13 +922,15 @@ load_dh_file(char *filename, bool isServerStart)
922922
(errcode(ERRCODE_CONFIG_FILE_ERROR),
923923
errmsg("invalid DH parameters: %s",
924924
SSLerrmessage(ERR_get_error()))));
925+
DH_free(dh);
925926
return NULL;
926927
}
927928
if (codes & DH_CHECK_P_NOT_PRIME)
928929
{
929930
ereport(isServerStart ? FATAL : LOG,
930931
(errcode(ERRCODE_CONFIG_FILE_ERROR),
931932
errmsg("invalid DH parameters: p is not prime")));
933+
DH_free(dh);
932934
return NULL;
933935
}
934936
if ((codes & DH_NOT_SUITABLE_GENERATOR) &&
@@ -937,6 +939,7 @@ load_dh_file(char *filename, bool isServerStart)
937939
ereport(isServerStart ? FATAL : LOG,
938940
(errcode(ERRCODE_CONFIG_FILE_ERROR),
939941
errmsg("invalid DH parameters: neither suitable generator or safe prime")));
942+
DH_free(dh);
940943
return NULL;
941944
}
942945

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/e835e89a0fd267871e7fbddc39ad00ee3d0cb55c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy