Mercurial > ublox > ublox8 > experimental
changeset 49:cf39d3a8140b
dump-common: use a constant-sized buffer allocation instead of alloca
Using alloca here caused the process stack size to grow without a bound on
FreeBSD 12 on the Raspberry Pi.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Thu, 16 Jan 2020 16:39:15 -0500 |
parents | 043c89d3ea58 |
children | d293465f3ced |
files | dump-common.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dump-common.c Thu Jan 16 12:37:57 2020 -0500 +++ b/dump-common.c Thu Jan 16 16:39:15 2020 -0500 @@ -57,8 +57,8 @@ } for (;;) { + uint8_t buf[(1u << 16) + 16]; /* plenty of any UBX message */ struct frame frame; - uint8_t *buf; int ret; ret = xfread(ifile, &frame, sizeof(frame)); @@ -79,7 +79,7 @@ break; } - buf = alloca(frame.len); + ASSERT3U(frame.len, <=, sizeof(buf)); ret = xfread(ifile, buf, frame.len); if (ret) {