From patchwork Mon May 25 12:32:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 476202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 35A171402A7 for ; Mon, 25 May 2015 22:45:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nHXgsTcB; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 462F528BF53; Mon, 25 May 2015 14:43:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id CA9E328BF37 for ; Mon, 25 May 2015 14:42:45 +0200 (CEST) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 25 May 2015 14:42:42 +0200 (CEST) Received: by pdea3 with SMTP id a3so69380394pde.2 for ; Mon, 25 May 2015 05:44:07 -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; bh=l10ChTf2WfIc0vDSJJ3bmp3hFVUnG6rHwqW5eKauPOc=; b=nHXgsTcBateBX+IRxZDYa8AqNbsotscXaf/878U3kyf+39iGacEJTkSnMvTI4BHAF9 0CyyBsrxna4+vUbY5mkcnvdYumTFpGKgx65j3NLXdgsaMZ2nmaG8KNRRIpZi2Ma+GqVs 84EPU5BDwjbkSChK1jltcA+Im3DdZcvouvCjfz/ppJaz52Pv1Sq7uWOIjn6oUR53D6Pn py1pjntNbsdin8dAtD5Si8id5a7KNpeR6fCbvsblHCd+56j8wFVNgU8t3Eifsx+5ZFaL wxhLZC+wPhjRh3f5RKURDv4Zy/obZA5gtNdj8bPUvHyXch7r11de/ZrsU+nS+LTscFnL Ra2A== X-Received: by 10.70.134.231 with SMTP id pn7mr39756878pdb.97.1432557847572; Mon, 25 May 2015 05:44:07 -0700 (PDT) Received: from debian.corp.sankuai.com ([103.29.140.56]) by mx.google.com with ESMTPSA id pj4sm4249342pbb.20.2015.05.25.05.44.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 May 2015 05:44:06 -0700 (PDT) From: Yousong Zhou To: nbd@openwrt.org Date: Mon, 25 May 2015 20:32:41 +0800 Message-Id: <1432557163-17492-3-git-send-email-yszhou4tech@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1432557163-17492-1-git-send-email-yszhou4tech@gmail.com> References: <1432557163-17492-1-git-send-email-yszhou4tech@gmail.com> Cc: openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH 2/4] delta: catch error when parsing delta line. X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Reported by sarumpaet [1] [1] uci fails to handle long values properly, https://github.com/openwrt/packages/issues/1231 Signed-off-by: Yousong Zhou --- delta.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/delta.c b/delta.c index 459d2c7..e9c79ab 100644 --- a/delta.c +++ b/delta.c @@ -293,13 +293,15 @@ static int uci_load_delta_file(struct uci_context *ctx, struct uci_package *p, c UCI_TRAP_SAVE(ctx, done); stream = uci_open_stream(ctx, filename, NULL, SEEK_SET, flush, false); + UCI_TRAP_RESTORE(ctx); + if (p) changes = uci_parse_delta(ctx, stream, p); - UCI_TRAP_RESTORE(ctx); + done: if (f) *f = stream; - else if (stream) + else uci_close_stream(stream); return changes; }