From 587e64f76a223496910eaa3f5f3d64022a6833a2 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Thu, 30 Dec 2021 13:55:06 +0100 Subject: [PATCH] Fix potential YAML format issue by enclosing "def" value in double quotes --- radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp | 4 ++++ radio/src/storage/yaml/yaml_datastructs_funcs.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp index 064a4346f..5c384a98e 100644 --- a/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp @@ -840,6 +840,7 @@ bool w_customFn(void* user, uint8_t* data, uint32_t bitoffs, const char* str = nullptr; bool add_comma = true; + if (!wf(opaque, "\"", 1)) return false; switch (func) { case FUNC_OVERRIDE_CHANNEL: @@ -973,6 +974,7 @@ bool w_customFn(void* user, uint8_t* data, uint32_t bitoffs, if (!wf(opaque, str, strlen(str))) return false; } } + if (!wf(opaque, "\"", 1)) return false; return true; } @@ -986,6 +988,7 @@ bool w_logicSw(void* user, uint8_t* data, uint32_t bitoffs, { data += bitoffs >> 3UL; data -= sizeof(LogicalSwitchData::func); + if (!wf(opaque,"\"",1)) return false; const char* str = nullptr; auto ls = reinterpret_cast(data); @@ -1037,6 +1040,7 @@ bool w_logicSw(void* user, uint8_t* data, uint32_t bitoffs, break; } + if (!wf(opaque,"\"",1)) return false; return true; } diff --git a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp index 396d1496d..e32659e62 100644 --- a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp @@ -1306,6 +1306,7 @@ static bool w_customFn(void* user, uint8_t* data, uint32_t bitoffs, const char* str = nullptr; bool add_comma = true; + if (!wf(opaque, "\"", 1)) return false; switch (func) { case FUNC_OVERRIDE_CHANNEL: @@ -1439,6 +1440,7 @@ static bool w_customFn(void* user, uint8_t* data, uint32_t bitoffs, if (!wf(opaque, str, strlen(str))) return false; } } + if (!wf(opaque, "\"", 1)) return false; return true; } @@ -1531,6 +1533,7 @@ static bool w_logicSw(void* user, uint8_t* data, uint32_t bitoffs, { data += bitoffs >> 3UL; data -= sizeof(LogicalSwitchData::func); + if (!wf(opaque,"\"",1)) return false; const char* str = nullptr; auto ls = reinterpret_cast(data); @@ -1582,6 +1585,7 @@ static bool w_logicSw(void* user, uint8_t* data, uint32_t bitoffs, break; } + if (!wf(opaque,"\"",1)) return false; return true; }