Avoid crash in http_e2e due to no string function for enum (#2582)

IOTHUB_CLIENT_CONFIRMATION_RESULT is not defined in the iothubclient_http_e2e.c,
causing MU_ENUM_TO_STRING to return NULL and strlen (stack below) to SEGFAULT,
since as per spec NULL arg to strlen has undefined behavior (thus assume the worst).

2024-02-21T22:23:23.0396823Z 240: ==9665== Process terminating with default action of signal 11 (SIGSEGV)
2024-02-21T22:23:23.0397379Z 240: ==9665==  Access not within mapped region at address 0x3
2024-02-21T22:23:23.0398384Z 240: ==9665==    at 0x48507D6: strlen (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_drd-amd64-linux.so)
2024-02-21T22:23:23.0399076Z 240: ==9665==    by 0x4E5DD14: __vfprintf_internal (vfprintf-internal.c:1688)
2024-02-21T22:23:23.0399629Z 240: ==9665==    by 0x4E70F99: __vsnprintf_internal (vsnprintf.c:114)
2024-02-21T22:23:23.0400154Z 240: ==9665==    by 0x119C0F: ctest_vsprintf_char (ctest.c:502)
2024-02-21T22:23:23.0400660Z 240: ==9665==    by 0x119CEF: ctest_sprintf_char (ctest.c:520)
2024-02-21T22:23:23.0401182Z 240: ==9665==    by 0x116634: IoTHub_HTTP_SendEvent_Shared_e2e (iothubclient_http_e2e.c:707)
2024-02-21T22:23:23.0401907Z 240: ==9665==    by 0x1191D0: RunTests (ctest.c:158)
2024-02-21T22:23:23.0402546Z 240: ==9665==    by 0x1189F8: main (main.c:9)
This commit is contained in:
Ewerton Scaboro da Silva 2024-02-22 11:55:20 -08:00 коммит произвёл GitHub
Родитель 9cf2994f42
Коммит 01e9e2d84e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -49,6 +49,7 @@ static IOTHUB_ACCOUNT_INFO_HANDLE g_iothubAcctInfo3 = NULL;
TEST_DEFINE_ENUM_TYPE(IOTHUB_TEST_CLIENT_RESULT, IOTHUB_TEST_CLIENT_RESULT_VALUES);
TEST_DEFINE_ENUM_TYPE(IOTHUB_CLIENT_RESULT, IOTHUB_CLIENT_RESULT_VALUES);
TEST_DEFINE_ENUM_TYPE(MAP_RESULT, MAP_RESULT_VALUES);
TEST_DEFINE_ENUM_TYPE(IOTHUB_CLIENT_CONFIRMATION_RESULT, IOTHUB_CLIENT_CONFIRMATION_RESULT_VALUES);
typedef struct EXPECTED_SEND_DATA_TAG
{