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

Commit0301036

Browse files
committed
Correct off-by-one when reading from pipe
In pg_basebackup.c:reached_end_position(), we're reading from aninternal pipe with our own background process but we're possiblyreading more bytes than will actually fit into our buffer due toan off-by-one error. As we're reading from an internal pipethere's no real risk here, but it's good form to not depend onsuch convenient arrangements.Bug spotted by the Coverity scanner.Back-patch to 9.2 where this showed up.
1 parent3355443 commit0301036

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ reached_end_position(XLogRecPtr segendpos, uint32 timeline,
174174
lo;
175175

176176
MemSet(xlogend,0,sizeof(xlogend));
177-
r=read(bgpipe[0],xlogend,sizeof(xlogend));
177+
r=read(bgpipe[0],xlogend,sizeof(xlogend)-1);
178178
if (r<0)
179179
{
180180
fprintf(stderr,_("%s: could not read from ready pipe: %s\n"),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp