Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
f210dcad
Commit
f210dcad
authored
Oct 16, 2006
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fixed a compile problem ("len" not defined) in inet_ntop4().
- Replaced sprintf() with snprintf() in inet_ntop6().
parent
178a1d20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
inet_ntop.c
lib/inet_ntop.c
+8
-6
No files found.
lib/inet_ntop.c
View file @
f210dcad
...
...
@@ -75,9 +75,10 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size)
{
static
const
char
*
fmt
=
"%u.%u.%u.%u"
;
char
tmp
[
sizeof
"255.255.255.255"
];
size_t
len
;
if
((
size_t
)
sprintf
(
tmp
,
fmt
,
src
[
0
],
src
[
1
],
src
[
2
],
src
[
3
])
>=
size
)
{
len
=
snprintf
(
tmp
,
sizeof
tmp
,
fmt
,
src
[
0
],
src
[
1
],
src
[
2
],
src
[
3
]);
if
(
len
>=
size
)
{
errno
=
ENOSPC
;
return
(
NULL
);
}
...
...
@@ -106,7 +107,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
char
tmp
[
sizeof
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"
],
*
tp
;
struct
{
int
base
,
len
;
}
best
,
cur
;
unsigned
int
words
[
NS_IN6ADDRSZ
/
NS_INT16SZ
];
int
i
;
int
i
,
inc
;
/*
* Preprocess:
...
...
@@ -157,13 +158,14 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
/* Is this address an encapsulated IPv4? */
if
(
i
==
6
&&
best
.
base
==
0
&&
(
best
.
len
==
6
||
(
best
.
len
==
5
&&
words
[
5
]
==
0xffff
)))
{
if
(
!
inet_ntop4
(
src
+
12
,
tp
,
sizeof
tmp
-
(
tp
-
tmp
)))
if
(
!
inet_ntop4
(
src
+
12
,
tp
,
sizeof
tmp
-
(
tp
-
tmp
)))
return
(
NULL
);
tp
+=
strlen
(
tp
);
break
;
}
tp
+=
sprintf
(
tp
,
"%x"
,
words
[
i
]);
inc
=
snprintf
(
tp
,
5
,
"%x"
,
words
[
i
]);
assert
(
inc
<
5
);
tp
+=
inc
;
}
/* Was it a trailing run of 0x00's? */
if
(
best
.
base
!=
-
1
&&
(
best
.
base
+
best
.
len
)
==
...
...
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