diff --git a/src/remote.cc b/src/remote.cc index 3e0f8a56..5776d624 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -132,9 +132,13 @@ void read(int socket, char* buffer, size_t size) template T read(int socket) { - char value[sizeof(T)]; + union + { + T object; + char value[sizeof(T)]; + }; read(socket, value, sizeof(T)); - return *(T*)(value); + return object; } template<>