зеркало из https://github.com/Azure/azure-umqtt-c.git
Родитель
45dfae80ad
Коммит
dd6b593b79
|
@ -132,15 +132,15 @@ if %MAKE_NUGET_PKG% == yes (
|
|||
|
||||
) else if %build-platform% == Win32 (
|
||||
echo ***Running CMAKE for Win32***
|
||||
cmake -LAH -Duse_cppunittest:BOOL=OFF %build-root% -Drun_unittests:BOOL=%CMAKE_run_unittests% -A Win32
|
||||
cmake -LAH -Duse_cppunittest:BOOL=OFF %build-root% -Drun_unittests:BOOL=%CMAKE_run_unittests% -A Win32 -G %VSVERSION%
|
||||
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
|
||||
) else if %build-platform% == arm (
|
||||
echo ***Running CMAKE for ARM***
|
||||
cmake -LAH -Duse_cppunittest:BOOL=OFF -Drun_unittests:BOOL=%CMAKE_run_unittests% %build-root% -A ARM
|
||||
cmake -LAH -Duse_cppunittest:BOOL=OFF -Drun_unittests:BOOL=%CMAKE_run_unittests% %build-root% -A ARM -G %VSVERSION%
|
||||
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
|
||||
) else (
|
||||
echo ***Running CMAKE for Win64***
|
||||
cmake -LAH -Duse_cppunittest:BOOL=OFF -Drun_unittests:BOOL=%CMAKE_run_unittests% %build-root% -A x64
|
||||
cmake -LAH -Duse_cppunittest:BOOL=OFF -Drun_unittests:BOOL=%CMAKE_run_unittests% %build-root% -A x64 -G %VSVERSION%
|
||||
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
|
||||
)
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1129147c38ac02ad974c4c701a1e01b2141b9fe2
|
||||
Subproject commit 3d14f91c58ee805ca4075d688fba1d95f496d16f
|
|
@ -14,6 +14,7 @@
|
|||
#include "azure_c_shared_utility/threadapi.h"
|
||||
#include "azure_c_shared_utility/tickcounter.h"
|
||||
#include "azure_c_shared_utility/xlogging.h"
|
||||
#include "azure_c_shared_utility/safe_math.h"
|
||||
|
||||
#include "azure_umqtt_c/mqtt_client.h"
|
||||
#include "azure_umqtt_c/mqtt_codec.h"
|
||||
|
@ -169,14 +170,19 @@ static char* byteutil_readUTF(uint8_t** buffer, size_t* byteLen)
|
|||
// not being asked to read a string longer than buffer passed in.
|
||||
if ((stringLen > 0) && ((size_t)(stringLen + (*buffer - bufferInitial)) <= *byteLen))
|
||||
{
|
||||
result = (char*)malloc((size_t)stringLen + 1);
|
||||
if (result != NULL)
|
||||
size_t malloc_size = safe_add_size_t((size_t)stringLen, 1);
|
||||
if (malloc_size != SIZE_MAX &&
|
||||
(result = (char*)malloc(malloc_size)) != NULL)
|
||||
{
|
||||
(void)memcpy(result, *buffer, stringLen);
|
||||
result[stringLen] = '\0';
|
||||
*buffer += stringLen;
|
||||
*byteLen = stringLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError("Cannot alloc memory, size:%zu", malloc_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -914,8 +920,9 @@ static void recvCompleteCallback(void* context, CONTROL_PACKET_TYPE packet, int
|
|||
}
|
||||
#endif
|
||||
// Allocate the remaining len
|
||||
suback.qosReturn = (QOS_VALUE*)malloc(sizeof(QOS_VALUE)*remainLen);
|
||||
if (suback.qosReturn != NULL)
|
||||
size_t malloc_size = safe_multiply_size_t(sizeof(QOS_VALUE), remainLen);
|
||||
if (malloc_size != SIZE_MAX &&
|
||||
(suback.qosReturn = (QOS_VALUE*)malloc(malloc_size)) != NULL)
|
||||
{
|
||||
while (remainLen > 0)
|
||||
{
|
||||
|
@ -950,7 +957,7 @@ static void recvCompleteCallback(void* context, CONTROL_PACKET_TYPE packet, int
|
|||
}
|
||||
else
|
||||
{
|
||||
LogError("allocation of quality of service value failed.");
|
||||
LogError("allocation of quality of service value failed, size:%zu", malloc_size);
|
||||
set_error_callback(mqtt_client, MQTT_CLIENT_MEMORY_ERROR);
|
||||
}
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче