Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
e7db8fa8
Commit
e7db8fa8
authored
Mar 04, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Assert check to catch vsnprintf overrunning its buffer. (Seen to
occur on Solaris 7 in 64-bit mode, for one.)
parent
aa39e9a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
src/backend/lib/stringinfo.c
src/backend/lib/stringinfo.c
+12
-1
No files found.
src/backend/lib/stringinfo.c
View file @
e7db8fa8
...
...
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: stringinfo.c,v 1.
29 2001/10/25 05:49:29 momjian
Exp $
* $Id: stringinfo.c,v 1.
30 2002/03/04 18:34:02 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -114,11 +114,22 @@ appendStringInfo(StringInfo str, const char *fmt,...)
avail
=
str
->
maxlen
-
str
->
len
-
1
;
if
(
avail
>
16
)
{
/*
* Assert check here is to catch buggy vsnprintf that overruns
* the specified buffer length. Solaris 7 in 64-bit mode is
* an example of a platform with such a bug.
*/
#ifdef USE_ASSERT_CHECKING
str
->
data
[
str
->
maxlen
-
1
]
=
'\0'
;
#endif
va_start
(
args
,
fmt
);
nprinted
=
vsnprintf
(
str
->
data
+
str
->
len
,
avail
,
fmt
,
args
);
va_end
(
args
);
Assert
(
str
->
data
[
str
->
maxlen
-
1
]
==
'\0'
);
/*
* Note: some versions of vsnprintf return the number of chars
* actually stored, but at least one returns -1 on failure. Be
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment