mirror of
https://github.com/espressif/esp-rainmaker.git
synced 2026-01-19 11:55:36 +00:00
avoid GCC -O2 warning stringop-truncation
Signed-off-by: Nuno Gonçalves <nunojpg@gmail.com>
This commit is contained in:
@@ -216,11 +216,12 @@ static esp_err_t esp_rmaker_scenes_parse_info_and_flags(jparse_ctx_t *jctx, char
|
||||
*info = NULL;
|
||||
}
|
||||
|
||||
if (strlen(_info) > 0) {
|
||||
int len = strlen(_info);
|
||||
if (len > 0) {
|
||||
/* +1 for NULL termination */
|
||||
*info = (char *)MEM_CALLOC_EXTRAM(1, strlen(_info) + 1);
|
||||
*info = (char *)MEM_CALLOC_EXTRAM(1, len + 1);
|
||||
if (*info) {
|
||||
strncpy(*info, _info, strlen(_info));
|
||||
memcpy(*info, _info, len + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,11 +628,12 @@ static esp_err_t esp_rmaker_schedule_parse_info_and_flags(jparse_ctx_t *jctx, ch
|
||||
*info = NULL;
|
||||
}
|
||||
|
||||
if (strlen(_info) > 0) {
|
||||
int len = strlen(_info);
|
||||
if (len > 0) {
|
||||
/* +1 for NULL termination */
|
||||
*info = (char *)MEM_CALLOC_EXTRAM(1, strlen(_info) + 1);
|
||||
*info = (char *)MEM_CALLOC_EXTRAM(1, len + 1);
|
||||
if (*info) {
|
||||
strncpy(*info, _info, strlen(_info));
|
||||
memcpy(*info, _info, len + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user