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
16059d39
Commit
16059d39
authored
Feb 07, 2007
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace some strncpy() by strlcpy().
parent
f11aa82d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
30 deletions
+20
-30
contrib/chkpass/chkpass.c
contrib/chkpass/chkpass.c
+4
-7
contrib/dblink/dblink.c
contrib/dblink/dblink.c
+2
-2
src/backend/libpq/be-secure.c
src/backend/libpq/be-secure.c
+3
-3
src/backend/utils/fmgr/dfmgr.c
src/backend/utils/fmgr/dfmgr.c
+2
-3
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+2
-3
src/bin/psql/tab-complete.c
src/bin/psql/tab-complete.c
+3
-6
src/interfaces/ecpg/preproc/descriptor.c
src/interfaces/ecpg/preproc/descriptor.c
+2
-3
src/test/regress/pg_regress.c
src/test/regress/pg_regress.c
+2
-3
No files found.
contrib/chkpass/chkpass.c
View file @
16059d39
...
...
@@ -4,7 +4,7 @@
* darcy@druid.net
* http://www.druid.net/darcy/
*
* $PostgreSQL: pgsql/contrib/chkpass/chkpass.c,v 1.1
7 2006/07/14 05:28:27 tgl
Exp $
* $PostgreSQL: pgsql/contrib/chkpass/chkpass.c,v 1.1
8 2007/02/07 00:52:35 petere
Exp $
* best viewed with tabs set to 4
*/
...
...
@@ -76,8 +76,7 @@ chkpass_in(PG_FUNCTION_ARGS)
if
(
*
str
==
':'
)
{
result
=
(
chkpass
*
)
palloc
(
sizeof
(
chkpass
));
strncpy
(
result
->
password
,
str
+
1
,
13
);
result
->
password
[
13
]
=
0
;
strlcpy
(
result
->
password
,
str
+
1
,
13
+
1
);
PG_RETURN_POINTER
(
result
);
}
...
...
@@ -150,8 +149,7 @@ chkpass_eq(PG_FUNCTION_ARGS)
if
(
a2
->
vl_len
<
12
)
sz
=
a2
->
vl_len
-
4
;
strncpy
(
str
,
a2
->
vl_dat
,
sz
);
str
[
sz
]
=
0
;
strlcpy
(
str
,
a2
->
vl_dat
,
sz
+
1
);
PG_RETURN_BOOL
(
strcmp
(
a1
->
password
,
crypt
(
str
,
a1
->
password
))
==
0
);
}
...
...
@@ -166,7 +164,6 @@ chkpass_ne(PG_FUNCTION_ARGS)
if
(
a2
->
vl_len
<
12
)
sz
=
a2
->
vl_len
-
4
;
strncpy
(
str
,
a2
->
vl_dat
,
sz
);
str
[
sz
]
=
0
;
strlcpy
(
str
,
a2
->
vl_dat
,
sz
+
1
);
PG_RETURN_BOOL
(
strcmp
(
a1
->
password
,
crypt
(
str
,
a1
->
password
))
!=
0
);
}
contrib/dblink/dblink.c
View file @
16059d39
...
...
@@ -8,7 +8,7 @@
* Darko Prenosil <Darko.Prenosil@finteh.hr>
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
*
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.6
1 2007/01/05 22:19:17 momjian
Exp $
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.6
2 2007/02/07 00:52:35 petere
Exp $
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
* ALL RIGHTS RESERVED;
*
...
...
@@ -2248,7 +2248,7 @@ createNewConnection(const char *name, remoteConn * rconn)
errmsg
(
"duplicate connection name"
)));
hentry
->
rconn
=
rconn
;
str
ncpy
(
hentry
->
name
,
name
,
NAMEDATALEN
-
1
);
str
lcpy
(
hentry
->
name
,
name
,
sizeof
(
hentry
->
name
)
);
}
static
void
...
...
src/backend/libpq/be-secure.c
View file @
16059d39
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.7
6 2007/01/26 20:06:52 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.7
7 2007/02/07 00:52:35 petere
Exp $
*
* Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database
...
...
@@ -933,8 +933,8 @@ aloop:
port
->
peer
=
SSL_get_peer_certificate
(
port
->
ssl
);
if
(
port
->
peer
==
NULL
)
{
str
n
cpy
(
port
->
peer_dn
,
"(anonymous)"
,
sizeof
(
port
->
peer_dn
));
str
n
cpy
(
port
->
peer_cn
,
"(anonymous)"
,
sizeof
(
port
->
peer_cn
));
str
l
cpy
(
port
->
peer_dn
,
"(anonymous)"
,
sizeof
(
port
->
peer_dn
));
str
l
cpy
(
port
->
peer_cn
,
"(anonymous)"
,
sizeof
(
port
->
peer_cn
));
}
else
{
...
...
src/backend/utils/fmgr/dfmgr.c
View file @
16059d39
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.9
3 2007/01/05 22:19:43 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.9
4 2007/02/07 00:52:35 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -539,8 +539,7 @@ find_in_dynamic_libpath(const char *basename)
len
=
piece
-
p
;
piece
=
palloc
(
len
+
1
);
strncpy
(
piece
,
p
,
len
);
piece
[
len
]
=
'\0'
;
strlcpy
(
piece
,
p
,
len
+
1
);
mangled
=
substitute_libpath_macro
(
piece
);
pfree
(
piece
);
...
...
src/backend/utils/misc/guc.c
View file @
16059d39
...
...
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.37
2 2007/02/01 19:10:28 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.37
3 2007/02/07 00:52:35 petere
Exp $
*
*--------------------------------------------------------------------
*/
...
...
@@ -5729,8 +5729,7 @@ ParseLongOption(const char *string, char **name, char **value)
if
(
string
[
equal_pos
]
==
'='
)
{
*
name
=
guc_malloc
(
FATAL
,
equal_pos
+
1
);
strncpy
(
*
name
,
string
,
equal_pos
);
(
*
name
)[
equal_pos
]
=
'\0'
;
strlcpy
(
*
name
,
string
,
equal_pos
+
1
);
*
value
=
guc_strdup
(
FATAL
,
&
string
[
equal_pos
+
1
]);
}
...
...
src/bin/psql/tab-complete.c
View file @
16059d39
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.15
7 2007/01/05 22:19:49 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.15
8 2007/02/07 00:52:35 petere
Exp $
*/
/*----------------------------------------------------------------------
...
...
@@ -2389,9 +2389,7 @@ previous_word(int point, int skip)
/* make a copy */
s
=
pg_malloc
(
end
-
start
+
2
);
strncpy
(
s
,
&
rl_line_buffer
[
start
],
end
-
start
+
1
);
s
[
end
-
start
+
1
]
=
'\0'
;
strlcpy
(
s
,
&
rl_line_buffer
[
start
],
end
-
start
+
2
);
return
s
;
}
...
...
@@ -2460,8 +2458,7 @@ dequote_file_name(char *text, char quote_char)
length = strlen(text);
s = pg_malloc(length - 2 + 1);
strncpy(s, text +1, length - 2);
s[length] = '\0';
strlcpy(s, text +1, length - 2 + 1);
return s;
}
...
...
src/interfaces/ecpg/preproc/descriptor.c
View file @
16059d39
/*
* functions needed for descriptor handling
*
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/descriptor.c,v 1.2
4 2006/03/11 04:38:40 momjian
Exp $
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/descriptor.c,v 1.2
5 2007/02/07 00:52:35 petere
Exp $
*
* since descriptor might be either a string constant or a string var
* we need to check for a constant if we expect a constant
...
...
@@ -323,7 +323,6 @@ descriptor_variable(const char *name, int input)
{
descriptor_names
[
1
],
(
struct
ECPGtype
*
)
&
descriptor_type
,
0
,
NULL
}
};
strncpy
(
descriptor_names
[
input
],
name
,
MAX_DESCRIPTOR_NAMELEN
);
descriptor_names
[
input
][
MAX_DESCRIPTOR_NAMELEN
-
1
]
=
0
;
strlcpy
(
descriptor_names
[
input
],
name
,
sizeof
(
descriptor_names
[
input
]));
return
(
struct
variable
*
)
&
varspace
[
input
];
}
src/test/regress/pg_regress.c
View file @
16059d39
...
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.2
8 2007/02/01 19:10:30 momjian
Exp $
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.2
9 2007/02/07 00:52:35 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -349,8 +349,7 @@ replace_string(char *string, char *replace, char *replacement)
{
char
*
dup
=
strdup
(
string
);
strncpy
(
string
,
dup
,
ptr
-
string
);
string
[
ptr
-
string
]
=
0
;
strlcpy
(
string
,
dup
,
ptr
-
string
+
1
);
strcat
(
string
,
replacement
);
strcat
(
string
,
dup
+
(
ptr
-
string
)
+
strlen
(
replace
));
free
(
dup
);
...
...
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