aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/odbc/socket.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/interfaces/odbc/socket.c b/src/interfaces/odbc/socket.c
index c4d0a1bec88..f8783197ec9 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;