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
48057977
Commit
48057977
authored
8 years ago
by
Marko Mikulicic
Committed by
Cesanta Bot
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix hexdump memory overflow
PUBLISHED_FROM=a6f3f33432ce43b6d4462de623ba61a53e7f18df
parent
4c038508
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
mongoose.c
mongoose.c
+5
-1
No files found.
mongoose.c
View file @
48057977
...
...
@@ -8667,6 +8667,9 @@ int mg_hexdump(const void *buf, int len, char *dst, int dst_len) {
if
(
i
>
0
)
n
+=
snprintf
(
dst
+
n
,
dst_len
-
n
,
" %s
\n
"
,
ascii
);
n
+=
snprintf
(
dst
+
n
,
dst_len
-
n
,
"%04x "
,
i
);
}
if
(
dst_len
-
n
<
0
)
{
return
n
;
}
n
+=
snprintf
(
dst
+
n
,
dst_len
-
n
,
" %02x"
,
p
[
i
]);
ascii
[
idx
]
=
p
[
i
]
<
0x20
||
p
[
i
]
>
0x7e
?
'.'
:
p
[
i
];
ascii
[
idx
+
1
]
=
'\0'
;
...
...
@@ -10787,7 +10790,8 @@ void mg_tun_log_frame(struct mg_tun_frame *frame) {
#if MG_ENABLE_HEXDUMP
{
char
hex
[
512
];
mg_hexdump
(
frame
->
body
.
p
,
frame
->
body
.
len
,
hex
,
sizeof
(
hex
));
mg_hexdump
(
frame
->
body
.
p
,
frame
->
body
.
len
,
hex
,
sizeof
(
hex
)
-
1
);
hex
[
sizeof
(
hex
)
-
1
]
=
'\0'
;
LOG
(
LL_DEBUG
,
(
"body:
\n
%s"
,
hex
));
}
#else
...
...
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