diff --git a/platform_specific/ubuntu/YamlParameters.cpp b/platform_specific/ubuntu/YamlParameters.cpp index 86b2b2a..a30959f 100644 --- a/platform_specific/ubuntu/YamlParameters.cpp +++ b/platform_specific/ubuntu/YamlParameters.cpp @@ -178,9 +178,9 @@ int8_t YamlParameters::__read_page(std::ifstream& params_storage_file, uint16_t* return LIBPARAMS_WRONG_ARGS; } - memcpy((void*)(flash.memory_ptr + offset), str_value.c_str(), - strlen(str_value.c_str())); - memcpy((void*)(flash.memory_ptr + offset + strlen(str_value.c_str())), "\0", 1); + size_t len = str_value.size(); + memcpy((void*)(flash.memory_ptr + offset), str_value.c_str(), len); + memcpy((void*)(flash.memory_ptr + offset + len), "\0", 1); *str_param_idx = *str_param_idx + 1; } } diff --git a/scripts/params.py b/scripts/params.py index 3268aa9..2ea0465 100755 --- a/scripts/params.py +++ b/scripts/params.py @@ -11,11 +11,12 @@ import sys from dataclasses import dataclass from color_logging import log_warn, log_err +from typing import Union @dataclass class BaseParam: name: str = "" - default: int | str = 0 + default: Union[int, str] = 0 note: str = "" mutability: str = "MUTABLE" enum_name: str = ""