mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
libpq: If ALPN is not used, make PQsslAttribute(conn, "alpn") == ""
The documentation says that PQsslAttribute(conn, "alpn") returns an empty string if ALPN is not used, but the code actually returned NULL. Fix the code to match the documentation. Reported-by: Michael Paquier Discussion: https://www.postgresql.org/message-id/ZideNHji0G4gxmc3@paquier.xyz
This commit is contained in:
@@ -1837,7 +1837,7 @@ PQsslAttribute(PGconn *conn, const char *attribute_name)
|
||||
|
||||
SSL_get0_alpn_selected(conn->ssl, &data, &len);
|
||||
if (data == NULL || len == 0 || len > sizeof(alpn_str) - 1)
|
||||
return NULL;
|
||||
return "";
|
||||
memcpy(alpn_str, data, len);
|
||||
alpn_str[len] = 0;
|
||||
return alpn_str;
|
||||
|
Reference in New Issue
Block a user