diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-07-30 11:06:12 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-07-30 11:06:12 +0000 |
commit | 8c8ecd1fa90cc83ebe35cd2c1b46133c72a8b5f7 (patch) | |
tree | 21d5b306740a85c986eba5f7305afc9b5014fdd1 /libs/lmo | |
parent | a6309fbeb8fb176230551740f7f1d2630c4fd71c (diff) |
libs/lmo: fix lmo_read32() (dereferencing type-punned pointer will break strict-aliasing rules)
Diffstat (limited to 'libs/lmo')
-rw-r--r-- | libs/lmo/src/lmo_core.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libs/lmo/src/lmo_core.c b/libs/lmo/src/lmo_core.c index f9e5331309..cd117bec80 100644 --- a/libs/lmo/src/lmo_core.c +++ b/libs/lmo/src/lmo_core.c @@ -22,13 +22,10 @@ extern char _lmo_error[1024]; static int lmo_read32( int fd, uint32_t *val ) { - uint8_t buffer[5]; - - if( read(fd, buffer, 4) < 4 ) + if( read(fd, val, 4) < 4 ) return -1; - buffer[4] = 0; - *val = ntohl(*((uint32_t *) buffer)); + *val = ntohl(*val); return 4; } |