From d81a612c5d73162743b475f3ca6a3e101562c05a Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 10 Jul 2014 16:20:04 +0200 Subject: [PATCH] SAT>IP: improve satip_frontend_pid_changed() - safe alloca() calls --- src/input/mpegts/satip/satip_frontend.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/input/mpegts/satip/satip_frontend.c b/src/input/mpegts/satip/satip_frontend.c index 51f54b7e..953930a8 100644 --- a/src/input/mpegts/satip/satip_frontend.c +++ b/src/input/mpegts/satip/satip_frontend.c @@ -819,7 +819,8 @@ satip_frontend_pid_changed( http_client_t *rtsp, count = lfe->sf_pids_count; if (count > lfe->sf_device->sd_pids_max) count = lfe->sf_device->sd_pids_max; - add = alloca(count * 5); + add = alloca(1 + count * 5); + add[0] = '\0'; /* prioritize higher PIDs (tables are low prio) */ satip_frontend_store_pids(add, &lfe->sf_pids[lfe->sf_pids_count - count], @@ -837,8 +838,8 @@ satip_frontend_pid_changed( http_client_t *rtsp, } else { - add = alloca(lfe->sf_pids_count * 5); - del = alloca(lfe->sf_pids_count * 5); + add = alloca(1 + lfe->sf_pids_count * 5); + del = alloca(1 + lfe->sf_pids_tcount * 5); add[0] = del[0] = '\0'; #if 0