Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A299EC4332F for ; Thu, 13 Oct 2022 08:17:13 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1C82084E3F; Thu, 13 Oct 2022 10:17:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.b="hwjU15wJ"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="aGi7pHgd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 384EC84E91; Thu, 13 Oct 2022 10:17:08 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9028B84F0B for ; Thu, 13 Oct 2022 10:17:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5E30721A8B; Thu, 13 Oct 2022 08:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1665649024; 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: in-reply-to:in-reply-to:references:references; bh=pQkThuCQswas8mM1ihm84gB5iG9FoDtIRfRtInyzvJ8=; b=hwjU15wJW1cYarLPg5DxhnbYXodaklDdWSPy11/mQpO9Tyo3iJIflvJh0W3prSt7L9EP6f JN+kKoqWF2kLBUENR0O+gmwwLUqx7QhVBLT4QUPHFaPfSBkFldHpudrabdRptg+9iEYhTj RMSrEl6TWqmVemMKlt5xHN8LE0DJMfs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1665649024; 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: in-reply-to:in-reply-to:references:references; bh=pQkThuCQswas8mM1ihm84gB5iG9FoDtIRfRtInyzvJ8=; b=aGi7pHgd66hLTI45AJHO6VL5H2g2evf63GDhe0Ku23ViptnE/9S0qt/YyzlSr69CmzBbq9 CVDPCT0WsUtjt7BA== Received: from naga.suse.cz (unknown [10.100.224.114]) by relay2.suse.de (Postfix) with ESMTP id 1EB912C141; Thu, 13 Oct 2022 08:17:04 +0000 (UTC) From: Michal Suchanek To: u-boot@lists.denx.de Cc: Michal Suchanek , Simon Glass , Daniel Schwierzeck , =?UTF-8?q?Marek=20Beh=C3=BAn?= , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Stefan Roese , Weijie Gao Subject: [PATCH v2 2/2] spl: spl_legacy: Fix printing image name Date: Thu, 13 Oct 2022 10:16:57 +0200 Message-Id: <20221013081657.16353-2-msuchanek@suse.de> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221013081657.16353-1-msuchanek@suse.de> References: <20221013081657.16353-1-msuchanek@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean image_set_name does not terminate the name in the image header. Then is should not be assumed it's nul terminated. image_print_contents correctly print only IH_NMLEN characters. Fix printing the unterminated field in spl_parse_legacy_header. The format specifies the minimum printed length, not maximum. Signed-off-by: Michal Suchanek Reviewed-by: Simon Glass --- (no changes since v1) --- common/spl/spl_legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c index b3624dfbb7..11c459254b 100644 --- a/common/spl/spl_legacy.c +++ b/common/spl/spl_legacy.c @@ -55,7 +55,7 @@ int spl_parse_legacy_header(struct spl_image_info *spl_image, spl_image->os = image_get_os(header); spl_image->name = image_get_name(header); debug(SPL_TPL_PROMPT - "payload image: %32s load addr: 0x%lx size: %d\n", + "payload image: %.*s load addr: 0x%lx size: %d\n", IH_NMLEN, spl_image->name, spl_image->load_addr, spl_image->size); return 0; -- 2.37.3