Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
2e1f56d9
Commit
2e1f56d9
authored
7 years ago
by
Sebastian Martin Dicke
Committed by
Hisham Muhammad
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Changed type of some integer variables to avoid overflows
parent
6ee99566
next
3.0.0beta5
3.0.0beta4
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
StringUtils.c
+5
-5
StringUtils.c
with
5 additions
and
5 deletions
+5
-5
StringUtils.c
View file @
2e1f56d9
...
...
@@ -27,11 +27,11 @@ in the source distribution for its full text.
*/
char
*
String_cat
(
const
char
*
s1
,
const
char
*
s2
)
{
in
t
l1
=
strlen
(
s1
);
in
t
l2
=
strlen
(
s2
);
size_
t
l1
=
strlen
(
s1
);
size_
t
l2
=
strlen
(
s2
);
char
*
out
=
xMalloc
(
l1
+
l2
+
1
);
strncpy
(
out
,
s1
,
l1
);
strncpy
(
out
+
l1
,
s2
,
l2
+
1
);
strncpy
(
out
+
l1
,
s2
,
l2
+
1
);
return
out
;
}
...
...
@@ -39,7 +39,7 @@ char* String_trim(const char* in) {
while
(
in
[
0
]
==
' '
||
in
[
0
]
==
'\t'
||
in
[
0
]
==
'\n'
)
{
in
++
;
}
in
t
len
=
strlen
(
in
);
size_
t
len
=
strlen
(
in
);
while
(
len
>
0
&&
(
in
[
len
-
1
]
==
' '
||
in
[
len
-
1
]
==
'\t'
||
in
[
len
-
1
]
==
'\n'
))
{
len
--
;
}
...
...
@@ -80,7 +80,7 @@ char** String_split(const char* s, char sep, int* n) {
s
+=
size
+
1
;
}
if
(
s
[
0
]
!=
'\0'
)
{
in
t
size
=
strlen
(
s
);
size_
t
size
=
strlen
(
s
);
char
*
token
=
xMalloc
(
size
+
1
);
strncpy
(
token
,
s
,
size
+
1
);
out
[
ctr
]
=
token
;
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help