Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dhcp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
64
Issues
64
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
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
ISC Open Source Projects
dhcp
Commits
db4e4aa2
Commit
db4e4aa2
authored
Jan 12, 2018
by
Thomas Markwalder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[master] Fixed relative file name crash
Merges in rt46957
parent
d394b602
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
26 deletions
+64
-26
RELNOTES
RELNOTES
+7
-0
client/dhclient.c
client/dhclient.c
+2
-8
common/print.c
common/print.c
+53
-13
includes/dhcpd.h
includes/dhcpd.h
+1
-0
server/dhcpd.c
server/dhcpd.c
+1
-5
No files found.
RELNOTES
View file @
db4e4aa2
...
...
@@ -103,6 +103,13 @@ by Eric Young (eay@cryptsoft.com).
cannot
rely
on
the
results
of
executable
statements
.
[
ISC
-
Bugs
#
45451
]
-
Fixed
a
bug
which
causes
dhcpd
and
dhclient
to
crash
on
certain
systems
when
given
relative
path
names
for
lease
or
pid
files
on
the
command
line
.
Affected
systems
are
those
on
which
the
C
library
function
,
realpath
()
does
not
support
a
second
parameter
value
of
NULL
(
see
manpages
for
realpath
(
3
)).
[
ISC
-
Bugs
#
46957
]
Changes
since
4.4.0
a1
(
New
Features
)
-
Added
experimental
support
for
relay
port
(
draft
-
ietf
-
dhc
-
relay
-
port
-
10.
txt
)
...
...
client/dhclient.c
View file @
db4e4aa2
...
...
@@ -639,17 +639,11 @@ main(int argc, char **argv) {
* to be reopened after chdir() has been called
*/
if
(
path_dhclient_db
[
0
]
!=
'/'
)
{
const
char
*
old_path
=
path_dhclient_db
;
path_dhclient_db
=
realpath
(
path_dhclient_db
,
NULL
);
if
(
path_dhclient_db
==
NULL
)
log_fatal
(
"Failed to get realpath for %s: %s"
,
old_path
,
strerror
(
errno
));
path_dhclient_db
=
absolute_path
(
path_dhclient_db
);
}
if
(
path_dhclient_script
[
0
]
!=
'/'
)
{
const
char
*
old_path
=
path_dhclient_script
;
path_dhclient_script
=
realpath
(
path_dhclient_script
,
NULL
);
if
(
path_dhclient_script
==
NULL
)
log_fatal
(
"Failed to get realpath for %s: %s"
,
old_path
,
strerror
(
errno
));
path_dhclient_script
=
absolute_path
(
path_dhclient_script
);
}
/*
...
...
common/print.c
View file @
db4e4aa2
...
...
@@ -3,7 +3,7 @@
Turn data structures into printable text. */
/*
* Copyright (c) 2004-201
7
by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-201
8
by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* This Source Code Form is subject to the terms of the Mozilla Public
...
...
@@ -132,7 +132,7 @@ char *print_base64 (const unsigned char *buf, unsigned len,
b
=
dmalloc
(
bl
+
1
,
file
,
line
);
if
(
!
b
)
return
(
char
*
)
0
;
i
=
0
;
s
=
b
;
while
(
i
!=
len
)
{
...
...
@@ -199,15 +199,15 @@ void print_lease (lease)
log_debug
(
" Lease %s"
,
piaddr
(
lease
->
ip_addr
));
t
=
gmtime
(
&
lease
->
starts
);
strftime
(
tbuf
,
sizeof
tbuf
,
"%Y/%m/%d %H:%M:%S"
,
t
);
log_debug
(
" start %s"
,
tbuf
);
t
=
gmtime
(
&
lease
->
ends
);
strftime
(
tbuf
,
sizeof
tbuf
,
"%Y/%m/%d %H:%M:%S"
,
t
);
log_debug
(
" end %s"
,
tbuf
);
if
(
lease
->
hardware_addr
.
hlen
)
log_debug
(
" hardware addr = %s"
,
print_hw_addr
(
lease
->
hardware_addr
.
hbuf
[
0
],
...
...
@@ -215,7 +215,7 @@ void print_lease (lease)
&
lease
->
hardware_addr
.
hbuf
[
1
]));
log_debug
(
" host %s "
,
lease
->
host
?
lease
->
host
->
name
:
"<none>"
);
}
}
#if defined (DEBUG_PACKET)
void
dump_packet_option
(
struct
option_cache
*
oc
,
...
...
@@ -301,7 +301,7 @@ void dump_raw (buf, len)
/*
1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123
280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .................
280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .................
*/
memset
(
lbuf
,
' '
,
79
);
...
...
@@ -446,7 +446,7 @@ void print_hex_or_string (len, data, limit, buf)
/*
* print a string as either hex or text
* using static buffers to hold the output
*
*
* len - length of data
* data - input data
* limit - length of buf
...
...
@@ -499,7 +499,7 @@ char *print_dotted_quads (len, data)
char
*
s
;
s
=
&
dq_buf
[
0
];
i
=
0
;
/* %Audit% Loop bounds checks to 21 bytes. %2004.06.17,Safe%
...
...
@@ -554,7 +554,7 @@ static unsigned print_subexpression (expr, buf, len)
return
3
;
}
break
;
case
expr_match
:
if
(
len
>
7
)
{
strcpy
(
buf
,
"(match)"
);
...
...
@@ -772,7 +772,7 @@ static unsigned print_subexpression (expr, buf, len)
case
expr_binary_xor
:
s
=
"^"
;
goto
binop
;
case
expr_not
:
if
(
len
>
6
)
{
rv
=
5
;
...
...
@@ -1179,7 +1179,7 @@ void print_expression (name, expr)
}
int
token_print_indent_concat
(
FILE
*
file
,
int
col
,
int
indent
,
const
char
*
prefix
,
const
char
*
prefix
,
const
char
*
suffix
,
...)
{
va_list
list
;
...
...
@@ -1209,7 +1209,7 @@ int token_print_indent_concat (FILE *file, int col, int indent,
s
=
va_arg
(
list
,
char
*
);
}
va_end
(
list
);
col
=
token_print_indent
(
file
,
col
,
indent
,
prefix
,
suffix
,
t
);
dfree
(
t
,
MDL
);
...
...
@@ -1439,3 +1439,43 @@ char *format_lease_id(const unsigned char *s, unsigned len,
}
return
(
idstr
);
}
/*
* Convert a relative path name to an absolute path name
*
* Not all versions of realpath() support NULL for
* the second parameter and PATH_MAX isn't defined
* on all systems. For the latter, we'll make what
* ought to be a big enough buffer and let it fly.
* If passed an absolute path it should return it
* an allocated buffer.
*/
char
*
absolute_path
(
const
char
*
orgpath
)
{
char
*
abspath
=
NULL
;
if
(
orgpath
)
{
#ifdef PATH_MAX
char
buf
[
PATH_MAX
];
#else
char
buf
[
2048
];
int
len
;
#endif
errno
=
0
;
if
(
realpath
(
orgpath
,
buf
)
==
NULL
)
{
const
char
*
errmsg
=
strerror
(
errno
);
log_fatal
(
"Failed to get realpath for %s: %s"
,
orgpath
,
errmsg
);
}
/* dup the result into an allocated buffer */
abspath
=
dmalloc
(
strlen
(
buf
)
+
1
,
MDL
);
if
(
abspath
==
NULL
)
{
log_fatal
(
"No memory for filename:%s
\n
"
,
buf
);
}
memcpy
(
abspath
,
buf
,
strlen
(
buf
));
abspath
[
strlen
(
buf
)]
=
0x0
;
}
return
(
abspath
);
}
includes/dhcpd.h
View file @
db4e4aa2
...
...
@@ -2635,6 +2635,7 @@ char *buf_to_hex (const unsigned char *s, unsigned len,
const
char
*
file
,
int
line
);
char
*
format_lease_id
(
const
unsigned
char
*
s
,
unsigned
len
,
int
format
,
const
char
*
file
,
int
line
);
char
*
absolute_path
(
const
char
*
orgpath
);
/* socket.c */
#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
|| defined (USE_SOCKET_FALLBACK)
...
...
server/dhcpd.c
View file @
db4e4aa2
...
...
@@ -607,11 +607,7 @@ main(int argc, char **argv) {
* to be reopened after chdir() has been called
*/
if
(
have_dhcpd_db
&&
path_dhcpd_db
[
0
]
!=
'/'
)
{
const
char
*
path
=
path_dhcpd_db
;
path_dhcpd_db
=
realpath
(
path_dhcpd_db
,
NULL
);
if
(
path_dhcpd_db
==
NULL
)
log_fatal
(
"Failed to get realpath for %s: %s"
,
path
,
strerror
(
errno
));
path_dhcpd_db
=
absolute_path
(
path_dhcpd_db
);
}
if
(
!
quiet
)
{
...
...
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