Repository : ssh://git@open-mesh.org/alfred
On branch : master
commit c67658a715ad71394b3d4f3a82023b11a085a1fc Author: Sven Eckelmann sven@narfation.org Date: Wed Jun 25 13:35:57 2014 +0200
alfred-gpsd: Calculate size of global buffer and not of a single char
The global buffer is 65536 bytes in size and not only 1 byte. This statement evaluated to a negative value which was casted to an unsigned value (aka... very large value).
This is a regression was introduced in 71dbc00fd879f1e592b07d8397f724fb3f69ac64 ("alfred: Use strncpy instead of strcpy for string").
Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Simon Wunderlich sw@simonwunderlich.de
c67658a715ad71394b3d4f3a82023b11a085a1fc gpsd/alfred-gpsd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gpsd/alfred-gpsd.c b/gpsd/alfred-gpsd.c index 84a0ded..d6cdfd6 100644 --- a/gpsd/alfred-gpsd.c +++ b/gpsd/alfred-gpsd.c @@ -301,7 +301,7 @@ static void gpsd_read_gpsd(struct globals *globals) size_t cnt; bool eol = false; char buf[4096]; - const size_t tpv_size = sizeof(*globals->buf) - + const size_t tpv_size = sizeof(globals->buf) - sizeof(*globals->push) - sizeof(struct alfred_data) - sizeof(*globals->gpsd_data); @@ -450,7 +450,7 @@ static int gpsd_server(struct globals *globals) int max_fd, ret; const size_t overhead = sizeof(*globals->push) + sizeof(struct alfred_data); - const size_t tpv_size = sizeof(*globals->buf) - + const size_t tpv_size = sizeof(globals->buf) - sizeof(*globals->push) - sizeof(struct alfred_data) - sizeof(*globals->gpsd_data);