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
1ccc2451
Commit
1ccc2451
authored
Aug 12, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert possibly-unsafe sprintf's to snprintf's.
parent
b47c4ddc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
16 deletions
+28
-16
src/backend/port/dynloader/freebsd.c
src/backend/port/dynloader/freebsd.c
+9
-5
src/backend/port/dynloader/netbsd.c
src/backend/port/dynloader/netbsd.c
+9
-5
src/backend/port/dynloader/nextstep.c
src/backend/port/dynloader/nextstep.c
+1
-1
src/backend/port/dynloader/openbsd.c
src/backend/port/dynloader/openbsd.c
+9
-5
No files found.
src/backend/port/dynloader/freebsd.c
View file @
1ccc2451
...
@@ -63,13 +63,15 @@ void *
...
@@ -63,13 +63,15 @@ void *
BSD44_derived_dlopen
(
const
char
*
file
,
int
num
)
BSD44_derived_dlopen
(
const
char
*
file
,
int
num
)
{
{
#if defined(__mips__)
#if defined(__mips__)
sprintf
(
error_message
,
"dlopen (%s) not supported"
,
file
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlopen (%s) not supported"
,
file
);
return
NULL
;
return
NULL
;
#else
#else
void
*
vp
;
void
*
vp
;
if
((
vp
=
dlopen
((
char
*
)
file
,
num
))
==
(
void
*
)
NULL
)
if
((
vp
=
dlopen
((
char
*
)
file
,
num
))
==
(
void
*
)
NULL
)
sprintf
(
error_message
,
"dlopen '%s' failed. (%s)"
,
file
,
dlerror
());
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlopen '%s' failed. (%s)"
,
file
,
dlerror
());
return
vp
;
return
vp
;
#endif
#endif
}
}
...
@@ -78,7 +80,8 @@ void *
...
@@ -78,7 +80,8 @@ void *
BSD44_derived_dlsym
(
void
*
handle
,
const
char
*
name
)
BSD44_derived_dlsym
(
void
*
handle
,
const
char
*
name
)
{
{
#if defined(__mips__)
#if defined(__mips__)
sprintf
(
error_message
,
"dlsym (%s) failed"
,
name
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlsym (%s) failed"
,
name
);
return
NULL
;
return
NULL
;
#else
#else
void
*
vp
;
void
*
vp
;
...
@@ -88,12 +91,13 @@ BSD44_derived_dlsym(void *handle, const char *name)
...
@@ -88,12 +91,13 @@ BSD44_derived_dlsym(void *handle, const char *name)
if
(
*
name
!=
'_'
)
if
(
*
name
!=
'_'
)
{
{
s
printf
(
buf
,
"_%s"
,
name
);
s
nprintf
(
buf
,
sizeof
(
buf
)
,
"_%s"
,
name
);
name
=
buf
;
name
=
buf
;
}
}
#endif
#endif
if
((
vp
=
dlsym
(
handle
,
(
char
*
)
name
))
==
(
void
*
)
NULL
)
if
((
vp
=
dlsym
(
handle
,
(
char
*
)
name
))
==
(
void
*
)
NULL
)
sprintf
(
error_message
,
"dlsym (%s) failed"
,
name
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlsym (%s) failed"
,
name
);
return
vp
;
return
vp
;
#endif
#endif
}
}
...
...
src/backend/port/dynloader/netbsd.c
View file @
1ccc2451
...
@@ -63,13 +63,15 @@ void *
...
@@ -63,13 +63,15 @@ void *
BSD44_derived_dlopen
(
const
char
*
file
,
int
num
)
BSD44_derived_dlopen
(
const
char
*
file
,
int
num
)
{
{
#if defined(__mips__)
#if defined(__mips__)
sprintf
(
error_message
,
"dlopen (%s) not supported"
,
file
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlopen (%s) not supported"
,
file
);
return
NULL
;
return
NULL
;
#else
#else
void
*
vp
;
void
*
vp
;
if
((
vp
=
dlopen
((
char
*
)
file
,
num
))
==
(
void
*
)
NULL
)
if
((
vp
=
dlopen
((
char
*
)
file
,
num
))
==
(
void
*
)
NULL
)
sprintf
(
error_message
,
"dlopen (%s) failed"
,
file
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlopen (%s) failed"
,
file
);
return
vp
;
return
vp
;
#endif
#endif
}
}
...
@@ -78,7 +80,8 @@ void *
...
@@ -78,7 +80,8 @@ void *
BSD44_derived_dlsym
(
void
*
handle
,
const
char
*
name
)
BSD44_derived_dlsym
(
void
*
handle
,
const
char
*
name
)
{
{
#if defined(__mips__)
#if defined(__mips__)
sprintf
(
error_message
,
"dlsym (%s) failed"
,
name
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlsym (%s) failed"
,
name
);
return
NULL
;
return
NULL
;
#elif defined(__ELF__)
#elif defined(__ELF__)
return
dlsym
(
handle
,
name
);
return
dlsym
(
handle
,
name
);
...
@@ -88,11 +91,12 @@ BSD44_derived_dlsym(void *handle, const char *name)
...
@@ -88,11 +91,12 @@ BSD44_derived_dlsym(void *handle, const char *name)
if
(
*
name
!=
'_'
)
if
(
*
name
!=
'_'
)
{
{
s
printf
(
buf
,
"_%s"
,
name
);
s
nprintf
(
buf
,
sizeof
(
buf
)
,
"_%s"
,
name
);
name
=
buf
;
name
=
buf
;
}
}
if
((
vp
=
dlsym
(
handle
,
(
char
*
)
name
))
==
(
void
*
)
NULL
)
if
((
vp
=
dlsym
(
handle
,
(
char
*
)
name
))
==
(
void
*
)
NULL
)
sprintf
(
error_message
,
"dlsym (%s) failed"
,
name
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlsym (%s) failed"
,
name
);
return
vp
;
return
vp
;
#endif
#endif
}
}
...
...
src/backend/port/dynloader/nextstep.c
View file @
1ccc2451
...
@@ -67,7 +67,7 @@ next_dlsym(void *handle, char *symbol)
...
@@ -67,7 +67,7 @@ next_dlsym(void *handle, char *symbol)
char
symbuf
[
1024
];
char
symbuf
[
1024
];
unsigned
long
symref
=
0
;
unsigned
long
symref
=
0
;
s
printf
(
symbuf
,
"_%s"
,
symbol
);
s
nprintf
(
symbuf
,
sizeof
(
symbuf
)
,
"_%s"
,
symbol
);
if
(
!
rld_lookup
(
errorStream
,
symbuf
,
&
symref
))
if
(
!
rld_lookup
(
errorStream
,
symbuf
,
&
symref
))
TransferError
(
errorStream
);
TransferError
(
errorStream
);
CloseError
(
errorStream
);
CloseError
(
errorStream
);
...
...
src/backend/port/dynloader/openbsd.c
View file @
1ccc2451
...
@@ -63,13 +63,15 @@ void *
...
@@ -63,13 +63,15 @@ void *
BSD44_derived_dlopen
(
const
char
*
file
,
int
num
)
BSD44_derived_dlopen
(
const
char
*
file
,
int
num
)
{
{
#if defined(__mips__)
#if defined(__mips__)
sprintf
(
error_message
,
"dlopen (%s) not supported"
,
file
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlopen (%s) not supported"
,
file
);
return
NULL
;
return
NULL
;
#else
#else
void
*
vp
;
void
*
vp
;
if
((
vp
=
dlopen
((
char
*
)
file
,
num
))
==
(
void
*
)
NULL
)
if
((
vp
=
dlopen
((
char
*
)
file
,
num
))
==
(
void
*
)
NULL
)
sprintf
(
error_message
,
"dlopen (%s) failed"
,
file
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlopen (%s) failed"
,
file
);
return
vp
;
return
vp
;
#endif
#endif
}
}
...
@@ -78,7 +80,8 @@ void *
...
@@ -78,7 +80,8 @@ void *
BSD44_derived_dlsym
(
void
*
handle
,
const
char
*
name
)
BSD44_derived_dlsym
(
void
*
handle
,
const
char
*
name
)
{
{
#if defined(__mips__)
#if defined(__mips__)
sprintf
(
error_message
,
"dlsym (%s) failed"
,
name
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlsym (%s) failed"
,
name
);
return
NULL
;
return
NULL
;
#elif defined(__ELF__)
#elif defined(__ELF__)
return
dlsym
(
handle
,
name
);
return
dlsym
(
handle
,
name
);
...
@@ -88,11 +91,12 @@ BSD44_derived_dlsym(void *handle, const char *name)
...
@@ -88,11 +91,12 @@ BSD44_derived_dlsym(void *handle, const char *name)
if
(
*
name
!=
'_'
)
if
(
*
name
!=
'_'
)
{
{
s
printf
(
buf
,
"_%s"
,
name
);
s
nprintf
(
buf
,
sizeof
(
buf
)
,
"_%s"
,
name
);
name
=
buf
;
name
=
buf
;
}
}
if
((
vp
=
dlsym
(
handle
,
(
char
*
)
name
))
==
(
void
*
)
NULL
)
if
((
vp
=
dlsym
(
handle
,
(
char
*
)
name
))
==
(
void
*
)
NULL
)
sprintf
(
error_message
,
"dlsym (%s) failed"
,
name
);
snprintf
(
error_message
,
sizeof
(
error_message
),
"dlsym (%s) failed"
,
name
);
return
vp
;
return
vp
;
#endif
#endif
}
}
...
...
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