Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
fcb9535e
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fcb9535e
编写于
8月 06, 2007
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix pg_restore to guard against unexpected EOF while reading an archive file.
Per report and partial patch from Chad Wagner.
上级
df9ea6a1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
20 deletion
+25
-20
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.c
+7
-5
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_custom.c
+6
-5
src/bin/pg_dump/pg_backup_files.c
src/bin/pg_dump/pg_backup_files.c
+5
-4
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_backup_tar.c
+7
-6
未找到文件。
src/bin/pg_dump/pg_backup_archiver.c
浏览文件 @
fcb9535e
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.14
4 2007/03/26 16:58:39
tgl Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.14
5 2007/08/06 01:38:14
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1472,7 +1472,7 @@ ReadStr(ArchiveHandle *AH)
int
l
;
l
=
ReadInt
(
AH
);
if
(
l
==
-
1
)
if
(
l
<
0
)
buf
=
NULL
;
else
{
...
...
@@ -1480,7 +1480,9 @@ ReadStr(ArchiveHandle *AH)
if
(
!
buf
)
die_horribly
(
AH
,
modulename
,
"out of memory
\n
"
);
(
*
AH
->
ReadBufPtr
)
(
AH
,
(
void
*
)
buf
,
l
);
if
((
*
AH
->
ReadBufPtr
)
(
AH
,
(
void
*
)
buf
,
l
)
!=
l
)
die_horribly
(
AH
,
modulename
,
"unexpected end of file
\n
"
);
buf
[
l
]
=
'\0'
;
}
...
...
@@ -2675,8 +2677,8 @@ ReadHead(ArchiveHandle *AH)
/* If we haven't already read the header... */
if
(
!
AH
->
readHeader
)
{
(
*
AH
->
ReadBufPtr
)
(
AH
,
tmpMag
,
5
);
if
((
*
AH
->
ReadBufPtr
)
(
AH
,
tmpMag
,
5
)
!=
5
)
die_horribly
(
AH
,
modulename
,
"unexpected end of file
\n
"
);
if
(
strncmp
(
tmpMag
,
"PGDMP"
,
5
)
!=
0
)
die_horribly
(
AH
,
modulename
,
"did not find magic string in file header
\n
"
);
...
...
src/bin/pg_dump/pg_backup_custom.c
浏览文件 @
fcb9535e
...
...
@@ -19,7 +19,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.3
8 2007/03/18 16:50:44 neilc
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.3
9 2007/08/06 01:38:14 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -712,7 +712,7 @@ _WriteByte(ArchiveHandle *AH, const int i)
*
* Called by the archiver to read bytes & integers from the archive.
* These routines are only used to read & write headers & TOC.
*
*
EOF should be treated as a fatal error.
*/
static
int
_ReadByte
(
ArchiveHandle
*
AH
)
...
...
@@ -720,9 +720,10 @@ _ReadByte(ArchiveHandle *AH)
lclContext
*
ctx
=
(
lclContext
*
)
AH
->
formatData
;
int
res
;
res
=
fgetc
(
AH
->
FH
);
if
(
res
!=
EOF
)
ctx
->
filePos
+=
1
;
res
=
getc
(
AH
->
FH
);
if
(
res
==
EOF
)
die_horribly
(
AH
,
modulename
,
"unexpected end of file
\n
"
);
ctx
->
filePos
+=
1
;
return
res
;
}
...
...
src/bin/pg_dump/pg_backup_files.c
浏览文件 @
fcb9535e
...
...
@@ -20,7 +20,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.3
2 2007/03/18 16:50:44 neilc
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.3
3 2007/08/06 01:38:15 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -395,9 +395,10 @@ _ReadByte(ArchiveHandle *AH)
lclContext
*
ctx
=
(
lclContext
*
)
AH
->
formatData
;
int
res
;
res
=
fgetc
(
AH
->
FH
);
if
(
res
!=
EOF
)
ctx
->
filePos
+=
1
;
res
=
getc
(
AH
->
FH
);
if
(
res
==
EOF
)
die_horribly
(
AH
,
modulename
,
"unexpected end of file
\n
"
);
ctx
->
filePos
+=
1
;
return
res
;
}
...
...
src/bin/pg_dump/pg_backup_tar.c
浏览文件 @
fcb9535e
...
...
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.5
8 2007/03/18 16:50:44 neilc
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.5
9 2007/08/06 01:38:15 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -510,7 +510,7 @@ _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh)
used
=
avail
;
/* Copy, and adjust buffer pos */
memcpy
(
buf
,
AH
->
lookahead
,
used
);
memcpy
(
buf
,
AH
->
lookahead
+
AH
->
lookaheadPos
,
used
);
AH
->
lookaheadPos
+=
used
;
/* Adjust required length */
...
...
@@ -766,12 +766,13 @@ static int
_ReadByte
(
ArchiveHandle
*
AH
)
{
lclContext
*
ctx
=
(
lclContext
*
)
AH
->
formatData
;
int
res
;
char
c
=
'\0'
;
size_t
res
;
unsigned
char
c
;
res
=
tarRead
(
&
c
,
1
,
ctx
->
FH
);
if
(
res
!=
EOF
)
ctx
->
filePos
+=
res
;
if
(
res
!=
1
)
die_horribly
(
AH
,
modulename
,
"unexpected end of file
\n
"
);
ctx
->
filePos
+=
1
;
return
c
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录