diff --git a/src/interfaces/odbc/socket.c b/src/interfaces/odbc/socket.c index c4d0a1bec8874ffe7509e25b75e8a08c07f7c924..f8783197ec9c1f8b0d2748180affac64685d8d63 100644 --- a/src/interfaces/odbc/socket.c +++ b/src/interfaces/odbc/socket.c @@ -227,23 +227,29 @@ SOCK_put_string(SocketClass *self, char *string) int SOCK_get_int(SocketClass *self, short len) { - char buf[4]; - switch (len) { case 2: - SOCK_get_n_char(self, buf, len); + { + unsigned short buf; + + SOCK_get_n_char(self, (char *) &buf, len); if (self->reverse) - return *((unsigned short *) buf); + return buf; else - return ntohs(*((unsigned short *) buf)); + return ntohs(buf); + } case 4: - SOCK_get_n_char(self, buf, len); + { + unsigned int buf; + + SOCK_get_n_char(self, (char *) &buf, len); if (self->reverse) - return *((unsigned int *) buf); + return buf; else - return ntohl(*((unsigned int *) buf)); + return ntohl(buf); + } default: self->errornumber = SOCKET_GET_INT_WRONG_LENGTH;