modify integral tryparse to use memcpy (#2295)
authorJohn Salem <josalem@microsoft.com>
Thu, 13 Feb 2020 02:14:46 +0000 (18:14 -0800)
committerHyungju Lee <leee.lee@samsung.com>
Fri, 30 Oct 2020 08:51:14 +0000 (17:51 +0900)
src/vm/diagnosticsprotocol.h

index 657e669..4669813 100644 (file)
@@ -24,7 +24,7 @@ bool TryParse(uint8_t *&bufferCursor, uint32_t &bufferLen, T &result)
 
     if (bufferLen < sizeof(T))
         return false;
-    result = *(reinterpret_cast<T *>(bufferCursor));
+    memcpy(&result, bufferCursor, sizeof(T));
     bufferCursor += sizeof(T);
     bufferLen -= sizeof(T);
     return true;