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
096164a7
Commit
096164a7
authored
Jul 17, 2023
by
serg3295
Committed by
J Mattsson
Jan 30, 2024
Browse files
fix(mqtt): adds parameter checking to nil
parent
9a9548b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/modules/mqtt.c
View file @
096164a7
...
...
@@ -368,14 +368,19 @@ static int mqtt_connect(lua_State* L) {
if
(
is_mqtt_uri
||
is_mqtts_uri
)
return
luaL_error
(
L
,
"port arg must be nil if giving full uri"
);
port
=
luaL_checknumber
(
L
,
n
);
n
++
;
}
else
if
(
lua_type
(
L
,
n
)
==
LUA_TNIL
)
{
n
++
;
}
n
++
;
if
(
lua_isnumber
(
L
,
n
))
{
if
(
is_mqtt_uri
||
is_mqtts_uri
)
return
luaL_error
(
L
,
"secure on/off determined by uri"
);
secure
=
!!
luaL_checkinteger
(
L
,
n
);
n
++
;
}
else
if
(
lua_type
(
L
,
n
)
==
LUA_TNIL
)
{
n
++
;
}
else
{
if
(
lua_istable
(
L
,
n
))
{
secure
=
true
;
...
...
@@ -396,9 +401,10 @@ static int mqtt_connect(lua_State* L) {
luaX_set_ref
(
L
,
-
1
,
&
mqtt_context
->
client_key_pem
);
}
lua_pop
(
L
,
1
);
//
n
++
;
}
}
n
++
;
if
(
lua_isnumber
(
L
,
n
))
{
reconnect
=
!!
luaL_checkinteger
(
L
,
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