Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SmartHome
NodeManager_GasSensor
Commits
ed46f774
Commit
ed46f774
authored
Oct 01, 2017
by
Lorenzo
Committed by
user2684
Oct 01, 2017
Browse files
Correct Request Class memory allocation (#214)
parent
ca8879fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
NodeManager.cpp
View file @
ed46f774
...
...
@@ -164,12 +164,14 @@ float Timer::getElapsed() {
*/
Request
::
Request
(
const
char
*
string
)
{
char
str
[
10
];
char
*
ptr
;
strcpy
(
str
,
string
);
// copy to working area
strcpy
((
char
*
)
&
_value
,
string
);
// tokenize the string and split function from value
strtok_r
(
str
,
","
,
&
ptr
);
_function
=
atoi
(
str
);
strtok_r
(
_value
,
","
,
&
ptr
);
// get function code
_function
=
atoi
(
_value
);
// move user data to working area
strcpy
(
_value
,
ptr
);
#if DEBUG == 1
Serial
.
print
(
F
(
"REQ F="
));
...
...
NodeManager.h
View file @
ed46f774
...
...
@@ -492,7 +492,8 @@ class Request {
private:
NodeManager
*
_node_manager
;
int
_function
;
char
*
_value
;
// Size of buffer to prevent overrun
char
_value
[
MAX_PAYLOAD
+
1
];
};
/***************************************
...
...
Write
Preview
Supports
Markdown
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