Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
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
esp
mongoose
Commits
2fa18b47
Commit
2fa18b47
authored
7 years ago
by
Deomid Ryabkov
Committed by
Cesanta Bot
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DNS name uncompression
PUBLISHED_FROM=07e820f539fa5feca2ad1cf81faca8404b773a65
parent
c8af7cdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
mongoose.c
mongoose.c
+9
-2
No files found.
mongoose.c
View file @
2fa18b47
...
...
@@ -10835,7 +10835,7 @@ int mg_parse_dns(const char *buf, int len, struct mg_dns_message *msg) {
size_t
mg_dns_uncompress_name
(
struct
mg_dns_message
*
msg
,
struct
mg_str
*
name
,
char
*
dst
,
int
dst_len
)
{
int
chunk_len
;
int
chunk_len
,
num_ptrs
=
0
;
char
*
old_dst
=
dst
;
const
unsigned
char
*
data
=
(
unsigned
char
*
)
name
->
p
;
const
unsigned
char
*
end
=
(
unsigned
char
*
)
msg
->
pkt
.
p
+
msg
->
pkt
.
len
;
...
...
@@ -10850,14 +10850,21 @@ size_t mg_dns_uncompress_name(struct mg_dns_message *msg, struct mg_str *name,
return
0
;
}
if
(
chunk_len
&
0xc0
)
{
if
(
(
chunk_len
&
0xc0
)
==
0xc0
)
{
uint16_t
off
=
(
data
[
-
1
]
&
(
~
0xc0
))
<<
8
|
data
[
0
];
if
(
off
>=
msg
->
pkt
.
len
)
{
return
0
;
}
/* Basic circular loop avoidance: allow up to 16 pointer hops. */
if
(
++
num_ptrs
>
15
)
{
return
0
;
}
data
=
(
unsigned
char
*
)
msg
->
pkt
.
p
+
off
;
continue
;
}
if
(
chunk_len
>
63
)
{
return
0
;
}
if
(
chunk_len
>
leeway
)
{
chunk_len
=
leeway
;
}
...
...
This diff is collapsed.
Click to expand it.
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