From nobody Sun Apr 28 13:30:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1610971618; cv=none; d=zohomail.com; s=zohoarc; b=YrCwmyPtGiXNRsdqTG9GljifFC3lDuBaie48VlXeTQ+X0gzv8xVS3IrmDY9ZN+T7gM2TcE33HDakahFRNfbzITSGYRT0HF4D/096fHah7rA6RlAvFKMK3rJ2uP8deE/YUe6mWPEcPirJ4PV3PfmWObivsRSM9Bv9q5nG6yjecSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610971618; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=6iNcyN7Kl6HeAw7fac0bU7X1mnM+1Tg2kyUNpDkinEE=; b=hB4A+UOreQD+P1AdGHlorJSVg6RJF+V7410C850fiL1DtDH9akaV9QI7cLqXJ+UKc2ZnDzz2K6JlM/yML+1BK2xnD4ZPykrSlqQbV6GEU5UGbNWZnG4QiQ2RGMxIEeUjqb2h+OYa8sInERwvOboQ2tv+p/f6dQ6WxpvrcfXSNhs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1610971618161175.79807858362415; Mon, 18 Jan 2021 04:06:58 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.69649.124808 (Exim 4.92) (envelope-from ) id 1l1TIm-0007Np-PO; Mon, 18 Jan 2021 12:06:32 +0000 Received: by outflank-mailman (output) from mailman id 69649.124808; Mon, 18 Jan 2021 12:06:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l1TIm-0007Ni-M9; Mon, 18 Jan 2021 12:06:32 +0000 Received: by outflank-mailman (input) for mailman id 69649; Mon, 18 Jan 2021 12:06:32 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l1TIm-0007Nd-2v for xen-devel@lists.xenproject.org; Mon, 18 Jan 2021 12:06:32 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id efafc66e-d45f-4b45-9678-3dcf42af7a42; Mon, 18 Jan 2021 12:06:30 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0ADB7ACBA; Mon, 18 Jan 2021 12:06:30 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: efafc66e-d45f-4b45-9678-3dcf42af7a42 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1610971590; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=6iNcyN7Kl6HeAw7fac0bU7X1mnM+1Tg2kyUNpDkinEE=; b=rA0rkQIbp6w+ujm0yK4lXFdx1Gscaouzl4juZ+7IiMQ4cIm6B3YPT8dCqO0eQmV11M+wie 0j4YF70Wd71yPPkR42yRK+pf4cG7Q2bahGEp+Sy4Qyn/B3NpM4QuoTS99FaTKrSDb5+j4P 6ZR8xik9P7Bpg4yLw40wxRLZ4WEe9Cs= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu Subject: [PATCH] tools/libxenhypfs: fix reading of gzipped string Date: Mon, 18 Jan 2021 13:06:28 +0100 Message-Id: <20210118120628.11722-1-jgross@suse.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Reading a gzipped string value from hypfs doesn't add a 0 byte at the end. Fix that. Fixes: 86234eafb95295 ("libs: add libxenhypfs") Signed-off-by: Juergen Gross Acked-by: Andrew Cooper --- tools/libs/hypfs/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c index f94c5ea1e2..52b30db8d7 100644 --- a/tools/libs/hypfs/core.c +++ b/tools/libs/hypfs/core.c @@ -146,12 +146,13 @@ static void *xenhypfs_inflate(void *in_data, size_t *= sz) break; =20 out_sz =3D z.next_out - workbuf; - content =3D realloc(content, *sz + out_sz); + content =3D realloc(content, *sz + out_sz + 1); if (!content) { ret =3D Z_MEM_ERROR; break; } memcpy(content + *sz, workbuf, out_sz); + *(char *)(content + *sz + out_sz) =3D 0; } =20 inflateEnd(&z); --=20 2.26.2