Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Use explicit_bzero() when clearing sslpassword in libpq
authorMichael Paquier <michael@paquier.xyz>
Thu, 21 May 2020 06:49:20 +0000 (15:49 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 21 May 2020 06:49:20 +0000 (15:49 +0900)
Since 74a308c, any security-sensitive information gets cleared from
memory this way.  This was forgotten in 4dc6355.

Author: Daniel Gustafsson
Reviewed-by: Peter Eisentraut, Michael Paquier
Discussion: https://postgr.es/m/935443BA-D42E-4CE0-B181-1AD79E6DD45A@yesql.se

src/interfaces/libpq/fe-connect.c

index d5da6dce1e6339173c4ebf93157226731403743f..ae4a32e45b22917e2d5bac4d5f6af1ed14cbfc48 100644 (file)
@@ -4037,7 +4037,10 @@ freePGconn(PGconn *conn)
    if (conn->sslkey)
        free(conn->sslkey);
    if (conn->sslpassword)
+   {
+       explicit_bzero(conn->sslpassword, strlen(conn->sslpassword));
        free(conn->sslpassword);
+   }
    if (conn->sslrootcert)
        free(conn->sslrootcert);
    if (conn->sslcrl)