Alleged race-condition was a bug in receiver
Handling put-requests was missing a trailing \0 in the parsed string.
This commit is contained in:
parent
16afb4b74c
commit
058ae7bae3
2 changed files with 4 additions and 13 deletions
|
@ -189,8 +189,10 @@ void generic_put_handler
|
|||
|
||||
if (from_str && (len = coap_get_payload(request, &bytes))) {
|
||||
if (c_ctype == REST.type.TEXT_PLAIN) {
|
||||
int l = MIN (len, sizeof (temp) - 1);
|
||||
temp [sizeof (temp) - 1] = 0;
|
||||
strncpy (temp, (const char *)bytes, MIN (len, sizeof (temp) - 1));
|
||||
strncpy (temp, (const char *)bytes, l);
|
||||
temp [l] = 0;
|
||||
} else { // jSON Format
|
||||
if (json_parse_variable (bytes, len, name, temp, sizeof (temp)) < 0) {
|
||||
success = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue