Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
036bff56
Unverified
Commit
036bff56
authored
May 20, 2019
by
Terry Ellison
Committed by
GitHub
May 20, 2019
Browse files
Use dynamic memory for cached DNS names (#2763)
Fixes #2511
parent
a62db236
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/lwip/core/dns.c
View file @
036bff56
...
@@ -177,7 +177,7 @@ struct dns_table_entry {
...
@@ -177,7 +177,7 @@ struct dns_table_entry {
u8_t
seqno
;
u8_t
seqno
;
u8_t
err
;
u8_t
err
;
u32_t
ttl
;
u32_t
ttl
;
char
name
[
DNS_MAX_NAME_LENGTH
]
;
char
*
name
;
ip_addr_t
ipaddr
;
ip_addr_t
ipaddr
;
/* pointer to callback on DNS query done */
/* pointer to callback on DNS query done */
dns_found_callback
found
;
dns_found_callback
found
;
...
@@ -924,11 +924,14 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
...
@@ -924,11 +924,14 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
LWIP_DEBUGF
(
DNS_DEBUG
,
(
"dns_enqueue:
\"
%s
\"
: use DNS entry %"
U16_F
"
\n
"
,
name
,
(
u16_t
)(
i
)));
LWIP_DEBUGF
(
DNS_DEBUG
,
(
"dns_enqueue:
\"
%s
\"
: use DNS entry %"
U16_F
"
\n
"
,
name
,
(
u16_t
)(
i
)));
/* fill the entry */
/* fill the entry */
namelen
=
LWIP_MIN
(
os_strlen
(
name
),
DNS_MAX_NAME_LENGTH
-
1
);
if
((
pEntry
->
name
=
(
char
*
)
mem_realloc
(
pEntry
->
name
,
namelen
+
1
))
==
NULL
)
{
return
ERR_MEM
;
}
pEntry
->
state
=
DNS_STATE_NEW
;
pEntry
->
state
=
DNS_STATE_NEW
;
pEntry
->
seqno
=
dns_seqno
++
;
pEntry
->
seqno
=
dns_seqno
++
;
pEntry
->
found
=
found
;
pEntry
->
found
=
found
;
pEntry
->
arg
=
callback_arg
;
pEntry
->
arg
=
callback_arg
;
namelen
=
LWIP_MIN
(
os_strlen
(
name
),
DNS_MAX_NAME_LENGTH
-
1
);
MEMCPY
(
pEntry
->
name
,
name
,
namelen
);
MEMCPY
(
pEntry
->
name
,
name
,
namelen
);
pEntry
->
name
[
namelen
]
=
0
;
pEntry
->
name
[
namelen
]
=
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