From patchwork Sun Mar 30 16:21:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Roth?= X-Patchwork-Id: 3909851 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1884FBF549 for ; Sun, 30 Mar 2014 16:22:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 405FA2038F for ; Sun, 30 Mar 2014 16:22:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2B7920357 for ; Sun, 30 Mar 2014 16:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbaC3QW2 (ORCPT ); Sun, 30 Mar 2014 12:22:28 -0400 Received: from mail-ee0-f44.google.com ([74.125.83.44]:61943 "EHLO mail-ee0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857AbaC3QWA (ORCPT ); Sun, 30 Mar 2014 12:22:00 -0400 Received: by mail-ee0-f44.google.com with SMTP id e49so5785487eek.17 for ; Sun, 30 Mar 2014 09:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Nkz7B2vU44AMnlQxlMLjTHgesDUxM1XDhzjK4UCkpn8=; b=XD3wTmx80oEko8HdYVLs5mz6aGcYieV387pj4lG9KG7Ig07gzajDMssJm6eqUvdwyo A3SYfes7CQbFNwcqJnegyA2UO+UVyAaRiZ51AmBCFOEa3er1tyYWlmB9UXdKjw7BlUtl MtemjhK3gIJtW99vS13/CiiconhJq3tLf3ukyg+imdxyNh2IzUvcoB13UdMzIB/mhHLt zth19E8Y0keaoP5UpapMJ5RY/pOVqyMAp48AuEt1pndxXLZurn8OYuWIi4Y8r0yGjtZS tVl4Mx2rNhur2BKoCQ6DOyBaDb3bhy26QAxttsXswbSw69DxhQbfio9UGtmOrqut5Hp8 Fgnw== X-Received: by 10.15.93.201 with SMTP id w49mr413433eez.69.1396196519262; Sun, 30 Mar 2014 09:21:59 -0700 (PDT) Received: from neutrino.exnihilo (29-206.60-188.cust.bluewin.ch. [188.60.206.29]) by mx.google.com with ESMTPSA id a4sm26747642eep.12.2014.03.30.09.21.57 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 30 Mar 2014 09:21:58 -0700 (PDT) From: =?UTF-8?q?Andr=C3=A9=20Roth?= To: linux-media@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Roth?= Subject: [PATCH 7/8] libdvbv5: fix lost ressource in atsc_eit Date: Sun, 30 Mar 2014 18:21:17 +0200 Message-Id: <1396196478-996-7-git-send-email-neolynx@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1396196478-996-1-git-send-email-neolynx@gmail.com> References: <1396196478-996-1-git-send-email-neolynx@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP if the title of the EIT event is longer than the available data, make sure the allocated buffer is not lost Signed-off-by: André Roth --- lib/libdvbv5/descriptors/atsc_eit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libdvbv5/descriptors/atsc_eit.c b/lib/libdvbv5/descriptors/atsc_eit.c index 92764df..9e1397d 100644 --- a/lib/libdvbv5/descriptors/atsc_eit.c +++ b/lib/libdvbv5/descriptors/atsc_eit.c @@ -74,6 +74,11 @@ ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, atsc_time(event->start_time, &event->start); event->source_id = eit->header.id; + if(!*head) + *head = event; + if(last) + last->next = event; + size = event->title_length - 1; if (p + size > endbuf) { dvb_logerr("%s: short read %zd/%zd bytes", __func__, @@ -83,11 +88,6 @@ ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, /* TODO: parse title */ p += size; - if(!*head) - *head = event; - if(last) - last->next = event; - /* get the descriptors for each program */ size = sizeof(union atsc_table_eit_desc_length); if (p + size > endbuf) {