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

Commitddf927f

Browse files
committed
Fix misuse of an integer as a bool.
pgtls_read_pending is declared to return bool, but what the underlyingSSL_pending function returns is a count of available bytes.This is actually somewhat harmless if we're using C99 bools, but inthe back branches it's a live bug: if the available-bytes count happenedto be a multiple of 256, it would get converted to a zero char value.On machines where char is signed, counts of 128 and up could misbehaveas well. The net effect is that when using SSL, libpq might blockwaiting for data even though some has already been received.Broken by careless refactoring in commit4e86f1b, so back-patchto 9.5 where that came in.Per bug #15802 from David Binderman.Discussion:https://postgr.es/m/15802-f0911a97f0346526@postgresql.org
1 parentcc86694 commitddf927f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎src/interfaces/libpq/fe-misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ pqSocketCheck(PGconn *conn, int forRead, int forWrite, time_t end_time)
10941094

10951095
#ifdefUSE_SSL
10961096
/* Check for SSL library buffering read bytes */
1097-
if (forRead&&conn->ssl_in_use&&pgtls_read_pending(conn)>0)
1097+
if (forRead&&conn->ssl_in_use&&pgtls_read_pending(conn))
10981098
{
10991099
/* short-circuit the select */
11001100
return1;

‎src/interfaces/libpq/fe-secure-openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ pgtls_read(PGconn *conn, void *ptr, size_t len)
264264
bool
265265
pgtls_read_pending(PGconn*conn)
266266
{
267-
returnSSL_pending(conn->ssl);
267+
returnSSL_pending(conn->ssl)>0;
268268
}
269269

270270
ssize_t

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp