Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
833ce37c
Commit
833ce37c
authored
24 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
new openbsd inspired implementation of strlcat()
parent
07e70185
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/strequal.c
+23
-8
23 additions, 8 deletions
lib/strequal.c
with
23 additions
and
8 deletions
lib/strequal.c
+
23
−
8
View file @
833ce37c
...
...
@@ -77,18 +77,33 @@ int Curl_strnequal(const char *first, const char *second, size_t max)
* For strlcat() that means the initial length of dst plus the length of
* src. While this may seem somewhat confusing it was done to make trunca-
* tion detection simple.
*
*
*/
size_t
strlcat
(
char
*
dst
,
const
char
*
src
,
size_t
size
)
{
size_t
len
=
strlen
(
dst
);
size_t
orglen
=
len
;
int
index
=
0
;
while
(
src
[
index
]
&&
(
len
<
(
size
-
1
))
)
{
dst
[
len
++
]
=
src
[
index
++
];
char
*
d
=
dst
;
const
char
*
s
=
src
;
size_t
n
=
siz
;
size_t
dlen
;
/* Find the end of dst and adjust bytes left but don't go past end */
while
(
n
--
!=
0
&&
*
d
!=
'\0'
)
d
++
;
dlen
=
d
-
dst
;
n
=
siz
-
dlen
;
if
(
n
==
0
)
return
(
dlen
+
strlen
(
s
));
while
(
*
s
!=
'\0'
)
{
if
(
n
!=
1
)
{
*
d
++
=
*
s
;
n
--
;
}
s
++
;
}
dst
[
len
]
=
0
;
*
d
=
'\0'
;
return
org
len
+
strlen
(
src
);
return
(
d
len
+
(
s
-
src
));
/* count does not include NUL */
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment