From 0b4f1e4b7b91eda59eceee1043aa4a1442b63493 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 16 Jul 2024 15:49:33 +0200 Subject: [PATCH] fec mult: handle invalid vals reasonably do not assert on invalid value but rather print an error --- src/transmit.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/transmit.cpp b/src/transmit.cpp index 84abacbb0..78dabf4a0 100644 --- a/src/transmit.cpp +++ b/src/transmit.cpp @@ -294,9 +294,13 @@ static bool set_fec(struct tx *tx, const char *fec_const) tx->fec_scheme = FEC_NONE; } else if(strcasecmp(fec, "mult") == 0) { tx->fec_scheme = FEC_MULT; - assert(strlen(fec_cfg) > 0); - tx->mult_count = (unsigned int) atoi(fec_cfg); - assert(tx->mult_count <= FEC_MAX_MULT); + tx->mult_count = atoi(fec_cfg); + if (tx->mult_count <= 0 || tx->mult_count > FEC_MAX_MULT) { + MSG(ERROR, + "mult count must be between 1 and %d (%d given)!\n", + FEC_MAX_MULT, tx->mult_count); + ret = false; + } } else if(strcasecmp(fec, "LDGM") == 0) { tx->fec_dup_1st_pkt = req_1st_pkt_dup; if(tx->media_type == TX_MEDIA_AUDIO) {