Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Dnsmasq
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
nanahira
Dnsmasq
Commits
25439064
Commit
25439064
authored
Nov 25, 2013
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Segfault with some CNAMEs. Also memory leak on reload of /etc/hosts.
parent
241fa9c6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
CHANGELOG
CHANGELOG
+6
-0
src/cache.c
src/cache.c
+10
-10
No files found.
CHANGELOG
View file @
25439064
...
@@ -33,6 +33,12 @@ version 2.68
...
@@ -33,6 +33,12 @@ version 2.68
get advertised with zero preferred time. Thanks to Tsachi
get advertised with zero preferred time. Thanks to Tsachi
for the bug report.
for the bug report.
Fix segfault with some locally configured CNAMEs. Thanks
to Andrew Childs for spotting the problem.
Fix memory leak on re-reading /etc/hosts and friends,
introduced in 2.67.
version 2.67
version 2.67
Fix crash if upstream server returns SERVFAIL when
Fix crash if upstream server returns SERVFAIL when
...
...
src/cache.c
View file @
25439064
...
@@ -320,7 +320,7 @@ static int cache_scan_free(char *name, struct all_addr *addr, time_t now, unsign
...
@@ -320,7 +320,7 @@ static int cache_scan_free(char *name, struct all_addr *addr, time_t now, unsign
if
(
is_expired
(
now
,
crecp
)
||
is_outdated_cname_pointer
(
crecp
))
if
(
is_expired
(
now
,
crecp
)
||
is_outdated_cname_pointer
(
crecp
))
{
{
*
up
=
crecp
->
hash_next
;
*
up
=
crecp
->
hash_next
;
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
)))
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
|
F_CONFIG
)))
{
{
cache_unlink
(
crecp
);
cache_unlink
(
crecp
);
cache_free
(
crecp
);
cache_free
(
crecp
);
...
@@ -354,13 +354,13 @@ static int cache_scan_free(char *name, struct all_addr *addr, time_t now, unsign
...
@@ -354,13 +354,13 @@ static int cache_scan_free(char *name, struct all_addr *addr, time_t now, unsign
if
(
is_expired
(
now
,
crecp
))
if
(
is_expired
(
now
,
crecp
))
{
{
*
up
=
crecp
->
hash_next
;
*
up
=
crecp
->
hash_next
;
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
)))
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
|
F_CONFIG
)))
{
{
cache_unlink
(
crecp
);
cache_unlink
(
crecp
);
cache_free
(
crecp
);
cache_free
(
crecp
);
}
}
}
}
else
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
))
&&
else
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
|
F_CONFIG
))
&&
(
flags
&
crecp
->
flags
&
F_REVERSE
)
&&
(
flags
&
crecp
->
flags
&
F_REVERSE
)
&&
(
flags
&
crecp
->
flags
&
(
F_IPV4
|
F_IPV6
))
&&
(
flags
&
crecp
->
flags
&
(
F_IPV4
|
F_IPV6
))
&&
memcmp
(
&
crecp
->
addr
.
addr
,
addr
,
addrlen
)
==
0
)
memcmp
(
&
crecp
->
addr
.
addr
,
addr
,
addrlen
)
==
0
)
...
@@ -558,7 +558,7 @@ struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsi
...
@@ -558,7 +558,7 @@ struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsi
(
crecp
->
flags
&
prot
)
&&
(
crecp
->
flags
&
prot
)
&&
hostname_isequal
(
cache_get_name
(
crecp
),
name
))
hostname_isequal
(
cache_get_name
(
crecp
),
name
))
{
{
if
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
))
if
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
|
F_CONFIG
))
{
{
*
chainp
=
crecp
;
*
chainp
=
crecp
;
chainp
=
&
crecp
->
next
;
chainp
=
&
crecp
->
next
;
...
@@ -599,7 +599,7 @@ struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsi
...
@@ -599,7 +599,7 @@ struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsi
{
{
/* expired entry, free it */
/* expired entry, free it */
*
up
=
crecp
->
hash_next
;
*
up
=
crecp
->
hash_next
;
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
)))
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
|
F_CONFIG
)))
{
{
cache_unlink
(
crecp
);
cache_unlink
(
crecp
);
cache_free
(
crecp
);
cache_free
(
crecp
);
...
@@ -649,7 +649,7 @@ struct crec *cache_find_by_addr(struct crec *crecp, struct all_addr *addr,
...
@@ -649,7 +649,7 @@ struct crec *cache_find_by_addr(struct crec *crecp, struct all_addr *addr,
if
((
crecp
->
flags
&
prot
)
&&
if
((
crecp
->
flags
&
prot
)
&&
memcmp
(
&
crecp
->
addr
.
addr
,
addr
,
addrlen
)
==
0
)
memcmp
(
&
crecp
->
addr
.
addr
,
addr
,
addrlen
)
==
0
)
{
{
if
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
))
if
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
|
F_CONFIG
))
{
{
*
chainp
=
crecp
;
*
chainp
=
crecp
;
chainp
=
&
crecp
->
next
;
chainp
=
&
crecp
->
next
;
...
@@ -665,7 +665,7 @@ struct crec *cache_find_by_addr(struct crec *crecp, struct all_addr *addr,
...
@@ -665,7 +665,7 @@ struct crec *cache_find_by_addr(struct crec *crecp, struct all_addr *addr,
else
else
{
{
*
up
=
crecp
->
hash_next
;
*
up
=
crecp
->
hash_next
;
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
)))
if
(
!
(
crecp
->
flags
&
(
F_HOSTS
|
F_DHCP
|
F_CONFIG
)))
{
{
cache_unlink
(
crecp
);
cache_unlink
(
crecp
);
cache_free
(
crecp
);
cache_free
(
crecp
);
...
@@ -923,7 +923,7 @@ void cache_reload(void)
...
@@ -923,7 +923,7 @@ void cache_reload(void)
for
(
cache
=
hash_table
[
i
],
up
=
&
hash_table
[
i
];
cache
;
cache
=
tmp
)
for
(
cache
=
hash_table
[
i
],
up
=
&
hash_table
[
i
];
cache
;
cache
=
tmp
)
{
{
tmp
=
cache
->
hash_next
;
tmp
=
cache
->
hash_next
;
if
(
cache
->
flags
&
F_HOSTS
)
if
(
cache
->
flags
&
(
F_HOSTS
|
F_CONFIG
)
)
{
{
*
up
=
cache
->
hash_next
;
*
up
=
cache
->
hash_next
;
free
(
cache
);
free
(
cache
);
...
@@ -947,7 +947,7 @@ void cache_reload(void)
...
@@ -947,7 +947,7 @@ void cache_reload(void)
for
(
intr
=
daemon
->
int_names
;
intr
;
intr
=
intr
->
next
)
for
(
intr
=
daemon
->
int_names
;
intr
;
intr
=
intr
->
next
)
if
(
hostname_isequal
(
a
->
target
,
intr
->
name
))
if
(
hostname_isequal
(
a
->
target
,
intr
->
name
))
{
{
struct
crec
*
aliasc
=
saf
e_malloc
(
sizeof
(
struct
crec
));
struct
crec
*
aliasc
=
whin
e_malloc
(
sizeof
(
struct
crec
));
aliasc
->
flags
=
F_FORWARD
|
F_NAMEP
|
F_CNAME
|
F_IMMORTAL
|
F_CONFIG
;
aliasc
->
flags
=
F_FORWARD
|
F_NAMEP
|
F_CNAME
|
F_IMMORTAL
|
F_CONFIG
;
aliasc
->
name
.
namep
=
a
->
alias
;
aliasc
->
name
.
namep
=
a
->
alias
;
aliasc
->
addr
.
cname
.
target
.
int_name
=
intr
;
aliasc
->
addr
.
cname
.
target
.
int_name
=
intr
;
...
@@ -1083,7 +1083,7 @@ void cache_add_dhcp_entry(char *host_name, int prot,
...
@@ -1083,7 +1083,7 @@ void cache_add_dhcp_entry(char *host_name, int prot,
while
((
crec
=
cache_find_by_name
(
crec
,
host_name
,
0
,
flags
|
F_CNAME
)))
while
((
crec
=
cache_find_by_name
(
crec
,
host_name
,
0
,
flags
|
F_CNAME
)))
{
{
/* check all addresses associated with name */
/* check all addresses associated with name */
if
(
crec
->
flags
&
F_HOSTS
)
if
(
crec
->
flags
&
(
F_HOSTS
|
F_CONFIG
)
)
{
{
if
(
crec
->
flags
&
F_CNAME
)
if
(
crec
->
flags
&
F_CNAME
)
my_syslog
(
MS_DHCP
|
LOG_WARNING
,
my_syslog
(
MS_DHCP
|
LOG_WARNING
,
...
...
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