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
fba32acb
Commit
fba32acb
authored
Dec 02, 2016
by
Alexander Alashkin
Committed by
Cesanta Bot
Dec 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace memcmp with strncmp in mongoose
PUBLISHED_FROM=3c5859f06ab838bba7c95c4878c4e7e883329810
parent
2fdb1f78
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
mongoose.c
mongoose.c
+10
-10
No files found.
mongoose.c
View file @
fba32acb
...
@@ -4850,7 +4850,7 @@ int mg_parse_uri(struct mg_str uri, struct mg_str *scheme,
...
@@ -4850,7 +4850,7 @@ int mg_parse_uri(struct mg_str uri, struct mg_str *scheme,
}
}
break
;
break
;
case
P_SCHEME_OR_PORT
:
case
P_SCHEME_OR_PORT
:
if
(
end
-
p
>=
3
&&
mem
cmp
(
p
,
"://"
,
3
)
==
0
)
{
if
(
end
-
p
>=
3
&&
strn
cmp
(
p
,
"://"
,
3
)
==
0
)
{
rscheme
.
p
=
uri
.
p
;
rscheme
.
p
=
uri
.
p
;
rscheme
.
len
=
p
-
uri
.
p
;
rscheme
.
len
=
p
-
uri
.
p
;
state
=
P_USER_INFO
;
state
=
P_USER_INFO
;
...
@@ -5885,7 +5885,7 @@ static int mg_http_multipart_wait_for_boundary(struct mg_connection *c) {
...
@@ -5885,7 +5885,7 @@ static int mg_http_multipart_wait_for_boundary(struct mg_connection *c) {
if
(
io
->
len
-
(
boundary_end
-
io
->
buf
)
<
4
)
{
if
(
io
->
len
-
(
boundary_end
-
io
->
buf
)
<
4
)
{
return
0
;
return
0
;
}
}
if
(
mem
cmp
(
boundary_end
,
"--
\r\n
"
,
4
)
==
0
)
{
if
(
strn
cmp
(
boundary_end
,
"--
\r\n
"
,
4
)
==
0
)
{
pd
->
mp_stream
.
state
=
MPS_FINALIZE
;
pd
->
mp_stream
.
state
=
MPS_FINALIZE
;
mbuf_remove
(
io
,
(
boundary_end
-
io
->
buf
)
+
4
);
mbuf_remove
(
io
,
(
boundary_end
-
io
->
buf
)
+
4
);
}
else
{
}
else
{
...
@@ -6621,7 +6621,7 @@ int mg_http_parse_header(struct mg_str *hdr, const char *var_name, char *buf,
...
@@ -6621,7 +6621,7 @@ int mg_http_parse_header(struct mg_str *hdr, const char *var_name, char *buf,
/* Find where variable starts */
/* Find where variable starts */
for
(
s
=
hdr
->
p
;
s
!=
NULL
&&
s
+
n
<
end
;
s
++
)
{
for
(
s
=
hdr
->
p
;
s
!=
NULL
&&
s
+
n
<
end
;
s
++
)
{
if
((
s
==
hdr
->
p
||
s
[
-
1
]
==
ch
||
s
[
-
1
]
==
ch1
)
&&
s
[
n
]
==
'='
&&
if
((
s
==
hdr
->
p
||
s
[
-
1
]
==
ch
||
s
[
-
1
]
==
ch1
)
&&
s
[
n
]
==
'='
&&
!
mem
cmp
(
s
,
var_name
,
n
))
!
strn
cmp
(
s
,
var_name
,
n
))
break
;
break
;
}
}
...
@@ -7590,9 +7590,9 @@ MG_INTERNAL int mg_http_common_url_parse(const char *url, const char *schema,
...
@@ -7590,9 +7590,9 @@ MG_INTERNAL int mg_http_common_url_parse(const char *url, const char *schema,
(
void
)
user
;
(
void
)
user
;
(
void
)
pass
;
(
void
)
pass
;
if
(
mem
cmp
(
url
,
schema
,
strlen
(
schema
))
==
0
)
{
if
(
strn
cmp
(
url
,
schema
,
strlen
(
schema
))
==
0
)
{
url
+=
strlen
(
schema
);
url
+=
strlen
(
schema
);
}
else
if
(
mem
cmp
(
url
,
schema_tls
,
strlen
(
schema_tls
))
==
0
)
{
}
else
if
(
strn
cmp
(
url
,
schema_tls
,
strlen
(
schema_tls
))
==
0
)
{
url
+=
strlen
(
schema_tls
);
url
+=
strlen
(
schema_tls
);
*
use_ssl
=
1
;
*
use_ssl
=
1
;
#if !MG_ENABLE_SSL
#if !MG_ENABLE_SSL
...
@@ -7779,7 +7779,7 @@ size_t mg_parse_multipart(const char *buf, size_t buf_len, char *var_name,
...
@@ -7779,7 +7779,7 @@ size_t mg_parse_multipart(const char *buf, size_t buf_len, char *var_name,
/* Scan through the body, search for terminating boundary */
/* Scan through the body, search for terminating boundary */
for
(
pos
=
hl
;
pos
+
(
bl
-
2
)
<
buf_len
;
pos
++
)
{
for
(
pos
=
hl
;
pos
+
(
bl
-
2
)
<
buf_len
;
pos
++
)
{
if
(
buf
[
pos
]
==
'-'
&&
!
mem
cmp
(
buf
,
&
buf
[
pos
],
bl
-
2
))
{
if
(
buf
[
pos
]
==
'-'
&&
!
strn
cmp
(
buf
,
&
buf
[
pos
],
bl
-
2
))
{
if
(
data_len
!=
NULL
)
*
data_len
=
(
pos
-
2
)
-
hl
;
if
(
data_len
!=
NULL
)
*
data_len
=
(
pos
-
2
)
-
hl
;
if
(
data
!=
NULL
)
*
data
=
buf
+
hl
;
if
(
data
!=
NULL
)
*
data
=
buf
+
hl
;
return
pos
;
return
pos
;
...
@@ -8419,10 +8419,10 @@ static void mg_send_ssi_file(struct mg_connection *nc, struct http_message *hm,
...
@@ -8419,10 +8419,10 @@ static void mg_send_ssi_file(struct mg_connection *nc, struct http_message *hm,
}
}
/* Handle known SSI directives */
/* Handle known SSI directives */
if
(
mem
cmp
(
p
,
d_include
.
p
,
d_include
.
len
)
==
0
)
{
if
(
strn
cmp
(
p
,
d_include
.
p
,
d_include
.
len
)
==
0
)
{
mg_do_ssi_include
(
nc
,
hm
,
path
,
p
+
d_include
.
len
+
1
,
include_level
,
mg_do_ssi_include
(
nc
,
hm
,
path
,
p
+
d_include
.
len
+
1
,
include_level
,
opts
);
opts
);
}
else
if
(
mem
cmp
(
p
,
d_call
.
p
,
d_call
.
len
)
==
0
)
{
}
else
if
(
strn
cmp
(
p
,
d_call
.
p
,
d_call
.
len
)
==
0
)
{
struct
mg_ssi_call_ctx
cctx
;
struct
mg_ssi_call_ctx
cctx
;
memset
(
&
cctx
,
0
,
sizeof
(
cctx
));
memset
(
&
cctx
,
0
,
sizeof
(
cctx
));
cctx
.
req
=
hm
;
cctx
.
req
=
hm
;
...
@@ -8432,7 +8432,7 @@ static void mg_send_ssi_file(struct mg_connection *nc, struct http_message *hm,
...
@@ -8432,7 +8432,7 @@ static void mg_send_ssi_file(struct mg_connection *nc, struct http_message *hm,
(
void
*
)
cctx
.
arg
.
p
);
/* NUL added above */
(
void
*
)
cctx
.
arg
.
p
);
/* NUL added above */
mg_call
(
nc
,
NULL
,
MG_EV_SSI_CALL_CTX
,
&
cctx
);
mg_call
(
nc
,
NULL
,
MG_EV_SSI_CALL_CTX
,
&
cctx
);
#if MG_ENABLE_HTTP_SSI_EXEC
#if MG_ENABLE_HTTP_SSI_EXEC
}
else
if
(
mem
cmp
(
p
,
d_exec
.
p
,
d_exec
.
len
)
==
0
)
{
}
else
if
(
strn
cmp
(
p
,
d_exec
.
p
,
d_exec
.
len
)
==
0
)
{
do_ssi_exec
(
nc
,
p
+
d_exec
.
len
+
1
);
do_ssi_exec
(
nc
,
p
+
d_exec
.
len
+
1
);
#endif
#endif
}
else
{
}
else
{
...
@@ -8447,7 +8447,7 @@ static void mg_send_ssi_file(struct mg_connection *nc, struct http_message *hm,
...
@@ -8447,7 +8447,7 @@ static void mg_send_ssi_file(struct mg_connection *nc, struct http_message *hm,
len
=
0
;
len
=
0
;
buf
[
len
++
]
=
ch
&
0xff
;
buf
[
len
++
]
=
ch
&
0xff
;
}
else
if
(
in_ssi_tag
)
{
}
else
if
(
in_ssi_tag
)
{
if
(
len
==
(
int
)
btag
.
len
&&
mem
cmp
(
buf
,
btag
.
p
,
btag
.
len
)
!=
0
)
{
if
(
len
==
(
int
)
btag
.
len
&&
strn
cmp
(
buf
,
btag
.
p
,
btag
.
len
)
!=
0
)
{
/* Not an SSI tag */
/* Not an SSI tag */
in_ssi_tag
=
0
;
in_ssi_tag
=
0
;
}
else
if
(
len
==
(
int
)
sizeof
(
buf
)
-
2
)
{
}
else
if
(
len
==
(
int
)
sizeof
(
buf
)
-
2
)
{
...
...
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