File tree 1 file changed +14
-8
lines changed
1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -227,23 +227,29 @@ SOCK_put_string(SocketClass *self, char *string)
227
227
int
228
228
SOCK_get_int (SocketClass * self , short len )
229
229
{
230
- char buf [4 ];
231
-
232
230
switch (len )
233
231
{
234
232
case 2 :
235
- SOCK_get_n_char (self , buf , len );
233
+ {
234
+ unsigned short buf ;
235
+
236
+ SOCK_get_n_char (self , (char * ) & buf , len );
236
237
if (self -> reverse )
237
- return * (( unsigned short * ) buf ) ;
238
+ return buf ;
238
239
else
239
- return ntohs (* ((unsigned short * ) buf ));
240
+ return ntohs (buf );
241
+ }
240
242
241
243
case 4 :
242
- SOCK_get_n_char (self , buf , len );
244
+ {
245
+ unsigned int buf ;
246
+
247
+ SOCK_get_n_char (self , (char * ) & buf , len );
243
248
if (self -> reverse )
244
- return * (( unsigned int * ) buf ) ;
249
+ return buf ;
245
250
else
246
- return ntohl (* ((unsigned int * ) buf ));
251
+ return ntohl (buf );
252
+ }
247
253
248
254
default :
249
255
self -> errornumber = SOCKET_GET_INT_WRONG_LENGTH ;
You can’t perform that action at this time.
0 commit comments