From patchwork Sat May 21 14:43:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gerrit-no-reply@lists.osmocom.org X-Patchwork-Id: 624845 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 3rBnbt5hMbz9t5Y for ; Sun, 22 May 2016 00:43:22 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 4274F630A; Sat, 21 May 2016 14:43:21 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from 127.0.1.12 (unknown [127.0.1.12]) by lists.osmocom.org (Postfix) with ESMTPA id 7CFF36304; Sat, 21 May 2016 14:43:19 +0000 (UTC) Date: Sat, 21 May 2016 14:43:19 +0000 From: Neels Hofmeyr Message-ID: X-Gerrit-MessageType: newchange Subject: [PATCH] openbsc[master]: rtp_proxy.c: Ensure msgb_alloc is large enough for largest A... X-Gerrit-Change-Id: If1ad5d2d68c85733306c75ea62f67fe8fbc143b3 X-Gerrit-ChangeURL: X-Gerrit-Commit: baac3ded2a9f573e7685aa7a624ade395a947111 MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/2.12.2-31-gb331dbd-dirty 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: , Reply-To: nhofmeyr@sysmocom.de Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" Review at https://gerrit.osmocom.org/91 rtp_proxy.c: Ensure msgb_alloc is large enough for largest AMR frame In AMR 12.2 (mode 7), the actual RTP payload is 33 bytes. Howeerver, as we store the length of the (dynamically-sized) AMR payload in the first byte, our buffer needs at least 33+1 byte in size. Change-Id: If1ad5d2d68c85733306c75ea62f67fe8fbc143b3 --- M openbsc/src/libtrau/rtp_proxy.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/91/91/1 diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c index 8c982c9..6c04610 100644 --- a/openbsc/src/libtrau/rtp_proxy.c +++ b/openbsc/src/libtrau/rtp_proxy.c @@ -172,7 +172,7 @@ /* always allocate for the maximum possible size to avoid * fragmentation */ new_msg = msgb_alloc(sizeof(struct gsm_data_frame) + - MAX_RTP_PAYLOAD_LEN, "GSM-DATA (TCH)"); + MAX_RTP_PAYLOAD_LEN+1, "GSM-DATA (TCH)"); if (!new_msg) return -ENOMEM;