Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
e8510bc4
Commit
e8510bc4
authored
Aug 30, 2013
by
Bernd Eckenfels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/inet.c: replace safe_strcpy with strdup for dynamically allocated cache, fixes truncation
parent
c0d46405
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
lib/inet.c
lib/inet.c
+3
-4
No files found.
lib/inet.c
View file @
e8510bc4
...
...
@@ -157,7 +157,7 @@ static int INET_rresolve(char *name, size_t len, struct sockaddr_in *sin,
}
ad
=
sin
->
sin_addr
.
s_addr
;
#ifdef DEBUG
fprintf
(
stderr
,
"rresolve: %08lx, mask %08x, num %08x
\n
"
,
ad
,
netmask
,
numeric
);
fprintf
(
stderr
,
"rresolve: %08lx, mask %08x, num %08x
, len %d
\n
"
,
ad
,
netmask
,
numeric
,
len
);
#endif
// if no symbolic names are requested we shortcut with ntoa
...
...
@@ -193,7 +193,7 @@ static int INET_rresolve(char *name, size_t len, struct sockaddr_in *sin,
if
(
pn
->
addr
.
sin_addr
.
s_addr
==
ad
&&
pn
->
host
==
host
)
{
safe_strncpy
(
name
,
pn
->
name
,
len
);
#ifdef DEBUG
fprintf
(
stderr
,
"rresolve: found %s %08lx in cache
\n
"
,
(
host
?
"host"
:
"net"
),
ad
);
fprintf
(
stderr
,
"rresolve: found %s %08lx in cache
(name=%s, len=%d)
\n
"
,
(
host
?
"host"
:
"net"
),
ad
,
name
,
len
);
#endif
return
(
0
);
}
...
...
@@ -224,8 +224,7 @@ static int INET_rresolve(char *name, size_t len, struct sockaddr_in *sin,
pn
->
addr
=
*
sin
;
pn
->
next
=
INET_nn
;
pn
->
host
=
host
;
pn
->
name
=
(
char
*
)
xmalloc
(
strlen
(
name
)
+
1
);
safe_strncpy
(
pn
->
name
,
name
,
sizeof
(
pn
->
name
));
pn
->
name
=
strdup
(
name
);
INET_nn
=
pn
;
return
(
0
);
...
...
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