From patchwork Wed Mar 16 16:11:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max X-Patchwork-Id: 598512 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3qQGj93YJXz9t3x for ; Thu, 17 Mar 2016 03:12:29 +1100 (AEDT) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 237821B73E; Wed, 16 Mar 2016 16:12:27 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from mail.sysmocom.de (mail.sysmocom.de [IPv6:2a01:4f8:191:444c::2:4]) by lists.osmocom.org (Postfix) with ESMTP id E900C1B737 for ; Wed, 16 Mar 2016 16:12:24 +0000 (UTC) Received: from mail.sysmocom.de (mail.sysmocom.de [144.76.43.93]) by mail.sysmocom.de (Postfix) with ESMTP id 98EDF15AE28; Wed, 16 Mar 2016 16:11:54 +0000 (UTC) Received: from pbell.local (ip5b418565.dynamic.kabel-deutschland.de [91.65.133.101]) by mail.sysmocom.de (Postfix) with ESMTPSA id 5ADDA15AE27; Wed, 16 Mar 2016 16:11:54 +0000 (UTC) From: msuraev@sysmocom.de To: openbsc@lists.osmocom.org Subject: [PATCH] Add explicit check for SI2quater index and count Date: Wed, 16 Mar 2016 17:11:52 +0100 Message-Id: <1458144712-16068-1-git-send-email-msuraev@sysmocom.de> X-Mailer: git-send-email 2.7.3 X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Max Right now we do not support multiple SI2quater messages, so return error if either index or count is non-zero. --- src/common/rsl.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/common/rsl.c b/src/common/rsl.c index a503355..ed8cced 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -298,9 +298,10 @@ static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg) { struct gsm_bts *bts = trx->bts; struct tlv_parsed tp; - uint8_t rsl_si; + uint8_t rsl_si, si2q_index, si2q_count; enum osmo_sysinfo_type osmo_si; - + struct gsm48_system_information_type_2quater *si2q; + struct bitvec bv; rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg)); /* 9.3.30 System Info Type */ @@ -327,6 +328,22 @@ static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg) TLVP_VAL(&tp, RSL_IE_FULL_BCCH_INFO), len); LOGP(DRSL, LOGL_INFO, " Rx RSL BCCH INFO (SI%s)\n", get_value_string(osmo_sitype_strs, osmo_si)); + + if (SYSINFO_TYPE_2quater == osmo_si) { + si2q = (struct gsm48_system_information_type_2quater *) + bts->si_buf[SYSINFO_TYPE_2quater]; + bv.data = si2q->rest_octets; + bv.data_len = 20; + bv.cur_bit = 3; + si2q_index = (uint8_t) bitvec_get_uint(&bv, 4); + si2q_count = (uint8_t) bitvec_get_uint(&bv, 4); + if (si2q_index || si2q_count) { + LOGP(DRSL, LOGL_ERROR, + " Rx RSL SI2quater witn unsupported index %u, count %u\n", + si2q_index, si2q_count); + return rsl_tx_error_report(trx, RSL_ERR_IE_CONTENT); + } + } } else if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) { uint16_t len = TLVP_LEN(&tp, RSL_IE_L3_INFO); if (len > sizeof(sysinfo_buf_t))