* Use PAL time functions in the console logger
* add platform time to unit tests
* disable time PAL functions in unit tests
* remove dead code
* fix trace logging unit tests
* disable pal on build_test_artifacts()
It can be demonstrated that the errno_t returned by strcpy_s
(which is described as a regular int by the signature) can
and will contain a positive error code. We therefore need to
check for non-zero returned value instead of strictly
negative integers.
See https://docs.microsoft.com/ for strcpy_s, wcscpy_s, _mbscpy_s
Zero if successful; otherwise, an error.
Co-authored-by: Olivier Dugas Ing <olivier.dugas@axceta.com>
* Test windows hosted agent
* Update CMakeLists.txt
* Update CMakeLists.txt
* generate c++ wrappers
* added generate_c_wrapper
* supress 4505
* fix 4505 warning
* vsprintf_wchar_with_empty_string_succeeds test
* fixed warnings and x64 build
* fix unix build
* fix guid tests
* fix win32 unit test
* putback compile_c_test_artifacts_as directive
* added back compile_c_test_artifacts_as
* fixed uniqueid_ut_test_file
* default use_cppunittest to off
x64 build will enable it to test both c and cpp unit tests
* fix cmake warnings
* move to cmake v3.5
* update to use our 1es agents
* pr feedback
* remove guid comment
* fixed EOF
The reported function raises a warning when compilers assert the flag
`-Warray-parameter=`, signaling that an array-type argument was promoted
to a pointer-type argument.
While in practice in most C implementations this is correct, fixing the
warning (and, in this case, indicating the maximum size for the array)
would represent a best-practice for finding out-of-bound accesses or
identifying wrongly-sized arrays passed in the function.
Signed-off-by: Francesco Giancane <francesco.giancane@accenture.com>
The HTTPAPI_REQUEST_TYPE enum is defined using the MU_DEFINE_ENUM
macro, which implicitely adds HTTPAPI_REQUEST_TYPE_INVALID as the first
value. This makes checking the validity of requestType with MU_COUNT_ARG
incorrect: HTTPAPI_REQUEST_TYPE_INVALID is accepted and
HTTPAPI_REQUEST_HEAD is rejected.
Unit tests:
- Change all uses of HTTPAPI_REQUEST_PATCH (the previous last value in the
enum) to HTTPAPI_REQUEST_HEAD (the current last value in the enum) to test
that it is accepted.
- Change HTTPAPIEX_ExecuteRequest_fails_with_invalid_request_type to use
a request type outside of the enum.
- Add HTTPAPIEX_ExecuteRequest_fails_with_invalid_request_type_2, which
explicitely tests that HTTPAPIEX_INVALID_ARG is rejected.
Co-authored-by: Pierrick Arsenault <pierrick.arsenault@stello.ca>
Co-authored-by: Eric Wolz <ericwol@microsoft.com>
This crash occurs for the following callstack:
==31911== Invalid read of size 8
==31911== at 0x144C04: DestroyInternal (optionhandler.c:111)
==31911== by 0x14517F: OptionHandler_Destroy (optionhandler.c:278)
==31911== by 0x144958: xio_retrieveoptions (xio.c:288)
==31911== by 0x140395: tlsio_openssl_retrieveoptions (tlsio_openssl.c:335)
==31911== by 0x14488B: xio_retrieveoptions (xio.c:276)
==31911== by 0x14F12C: ResetConnectionIfNecessary (iothubtransport_mqtt_common.c:1977)
==31911== by 0x15074B: UpdateMqttConnectionStateIfNeeded (iothubtransport_mqtt_common.c:2585)
==31911== by 0x15290C: IoTHubTransport_MQTT_Common_DoWork (iothubtransport_mqtt_common.c:3474)
==31911== by 0x14AD63: IoTHubTransportMqtt_DoWork (iothubtransportmqtt.c:121)
==31911== by 0x11DD46: IoTHubClientCore_LL_DoWork (iothub_client_core_ll.c:2123)
==31911== by 0x128F92: ScheduleWork_Thread (iothub_client_core.c:813)
==31911== by 0x1397D0: ThreadWrapper (threadapi_pthreads.c:35)
==31911== Address 0x6097008 is 24 bytes inside a block of size 32 free'd
==31911== at 0x48369AB: free (vg_replace_malloc.c:530)
==31911== by 0x144C98: DestroyInternal (optionhandler.c:123)
==31911== by 0x14517F: OptionHandler_Destroy (optionhandler.c:278)
==31911== by 0x14473A: xio_DestroyOption (xio.c:246)
==31911== by 0x144BD0: AddOptionInternal (optionhandler.c:91)
==31911== by 0x144FA6: OptionHandler_AddOption (optionhandler.c:219)
==31911== by 0x144907: xio_retrieveoptions (xio.c:285)
==31911== by 0x140395: tlsio_openssl_retrieveoptions (tlsio_openssl.c:335)
==31911== by 0x14488B: xio_retrieveoptions (xio.c:276)
==31911== by 0x14F12C: ResetConnectionIfNecessary (iothubtransport_mqtt_common.c:1977)
==31911== by 0x15074B: UpdateMqttConnectionStateIfNeeded (iothubtransport_mqtt_common.c:2585)
==31911== by 0x15290C: IoTHubTransport_MQTT_Common_DoWork (iothubtransport_mqtt_common.c:3474)
==31911== Block was alloc'd at
==31911== at 0x483577F: malloc (vg_replace_malloc.c:299)
==31911== by 0x144990: CreateInternal (optionhandler.c:28)
==31911== by 0x144D37: OptionHandler_Create (optionhandler.c:142)
==31911== by 0x14543E: socketio_retrieveoptions (socketio_berkeley.c:178)
==31911== by 0x14488B: xio_retrieveoptions (xio.c:276)
==31911== by 0x140395: tlsio_openssl_retrieveoptions (tlsio_openssl.c:335)
==31911== by 0x14488B: xio_retrieveoptions (xio.c:276)
==31911== by 0x14F12C: ResetConnectionIfNecessary (iothubtransport_mqtt_common.c:1977)
==31911== by 0x15074B: UpdateMqttConnectionStateIfNeeded (iothubtransport_mqtt_common.c:2585)
==31911== by 0x15290C: IoTHubTransport_MQTT_Common_DoWork (iothubtransport_mqtt_common.c:3474)
==31911== by 0x14AD63: IoTHubTransportMqtt_DoWork (iothubtransportmqtt.c:121)
==31911== by 0x11DD46: IoTHubClientCore_LL_DoWork (iothub_client_core_ll.c:2123)