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
f6165d23
Commit
f6165d23
authored
Nov 16, 2016
by
Alexander Alashkin
Committed by
Cesanta Bot
Nov 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stack overflow in mg_hexdump
PUBLISHED_FROM=5025692f3f4593b3ea38af51f8f49e1ac4df6b88
parent
e4a4b6f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
mongoose.c
mongoose.c
+10
-5
No files found.
mongoose.c
View file @
f6165d23
...
@@ -8888,6 +8888,11 @@ struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
...
@@ -8888,6 +8888,11 @@ struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
/* Amalgamated: #include "mongoose/src/internal.h" */
/* Amalgamated: #include "mongoose/src/internal.h" */
/* Amalgamated: #include "mongoose/src/util.h" */
/* Amalgamated: #include "mongoose/src/util.h" */
/* For platforms with limited libc */
#ifndef MAX
#define MAX(a,b) ((a) > (b)? (a): (b))
#endif
const
char
*
mg_skip
(
const
char
*
s
,
const
char
*
end
,
const
char
*
delims
,
const
char
*
mg_skip
(
const
char
*
s
,
const
char
*
end
,
const
char
*
delims
,
struct
mg_str
*
v
)
{
struct
mg_str
*
v
)
{
v
->
p
=
s
;
v
->
p
=
s
;
...
@@ -9056,19 +9061,19 @@ int mg_hexdump(const void *buf, int len, char *dst, int dst_len) {
...
@@ -9056,19 +9061,19 @@ int mg_hexdump(const void *buf, int len, char *dst, int dst_len) {
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
idx
=
i
%
16
;
idx
=
i
%
16
;
if
(
idx
==
0
)
{
if
(
idx
==
0
)
{
if
(
i
>
0
)
n
+=
snprintf
(
dst
+
n
,
dst_len
-
n
,
" %s
\n
"
,
ascii
);
if
(
i
>
0
)
n
+=
snprintf
(
dst
+
n
,
MAX
(
dst_len
-
n
,
0
)
,
" %s
\n
"
,
ascii
);
n
+=
snprintf
(
dst
+
n
,
dst_len
-
n
,
"%04x "
,
i
);
n
+=
snprintf
(
dst
+
n
,
MAX
(
dst_len
-
n
,
0
)
,
"%04x "
,
i
);
}
}
if
(
dst_len
-
n
<
0
)
{
if
(
dst_len
-
n
<
0
)
{
return
n
;
return
n
;
}
}
n
+=
snprintf
(
dst
+
n
,
dst_len
-
n
,
" %02x"
,
p
[
i
]);
n
+=
snprintf
(
dst
+
n
,
MAX
(
dst_len
-
n
,
0
)
,
" %02x"
,
p
[
i
]);
ascii
[
idx
]
=
p
[
i
]
<
0x20
||
p
[
i
]
>
0x7e
?
'.'
:
p
[
i
];
ascii
[
idx
]
=
p
[
i
]
<
0x20
||
p
[
i
]
>
0x7e
?
'.'
:
p
[
i
];
ascii
[
idx
+
1
]
=
'\0'
;
ascii
[
idx
+
1
]
=
'\0'
;
}
}
while
(
i
++
%
16
)
n
+=
snprintf
(
dst
+
n
,
dst_len
-
n
,
"%s"
,
" "
);
while
(
i
++
%
16
)
n
+=
snprintf
(
dst
+
n
,
MAX
(
dst_len
-
n
,
0
)
,
"%s"
,
" "
);
n
+=
snprintf
(
dst
+
n
,
dst_len
-
n
,
" %s
\n\n
"
,
ascii
);
n
+=
snprintf
(
dst
+
n
,
MAX
(
dst_len
-
n
,
0
)
,
" %s
\n\n
"
,
ascii
);
return
n
;
return
n
;
}
}
...
...
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