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 1DE5FC433FE for ; Tue, 22 Nov 2022 08:32:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 31E6E851A5; Tue, 22 Nov 2022 09:32:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oeWMujLa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A076584F87; Tue, 22 Nov 2022 09:32:44 +0100 (CET) Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 763F8851B2 for ; Tue, 22 Nov 2022 09:32:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilin.mikhail.ol@gmail.com Received: by mail-lf1-x12c.google.com with SMTP id j16so22475176lfe.12 for ; Tue, 22 Nov 2022 00:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/+uAC/cLvUEtbjcJZO0O3INUzmQu3d+3CxGcwzMMvOA=; b=oeWMujLaXnRvDT5JAO7Fx06TBm0ebKTBeYpvei6SpJuH3Go5NsVYdJsJAj9zgqccdZ wRL3u/BIIsJhFbjT9y0FW6Q8rfcFumgDHy4nuddFvMg8UzGWK6uHfaXzNnvBpUKYNueA 0CPp4rYkXN1YNKMkGdZinC+RR8e3Y3YrGPz2VhfB0SrRrGmiUxJB1YyL0PbltMgOF7kf 4q5Nds3Py0isti0bl+v07+iK3+L355SvzVCkwkP0IvceTV9QMFGYblwZ5bZ15dQGhpwF AFh/PsEhx9ESGH+benE7EmVLW7OxKOzcG9mw4AealxMQT6xoiIgILiAiv4D1VMOHGRur 2KmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/+uAC/cLvUEtbjcJZO0O3INUzmQu3d+3CxGcwzMMvOA=; b=8Bndf/dRBtxJfrRFZrw+5YJbxJgAGT/QaLQQXnCR+0QGdQ7ZWXhz9q3nKOFm48RpiN D0UqjkSNq39sC15utbe2bd7zEaUh1RD9YLjyCcN810I5cETuega+Q59qYgf1XGTuk/3X ZdFj5aZVgZ70DKecntGwJ77JM6LAGd1VvM8jmweQHrV3o1g/CusO8Da08tQxpu75urcF B6vvplDHjSNagzKq4ZucuoAZ2xzD8hF0ANzN4LsG9HngHmaxCTezW5zbbIWJZi05GKUY BkkTz6RHm4EBzJJ8RcXgOPqJxayAmc3hDLHRRW5L9kzJyK5zig6B6hfw1jndlA5Q3x5D DLEQ== X-Gm-Message-State: ANoB5pkvUdn99XIswzdLNNxg9vIjVrCQcZM61iGuFnSqcsxxL3cGvvoK rF5DIRZbw+mU9xkrtyH5egLCPEQ0F64= X-Google-Smtp-Source: AA0mqf7VwfVWCKsWUcr54rlKGQRKInqm5SniNNmHYBIdxOg60UKeW1gpri8XLnDlSfEK31kfM0kO7g== X-Received: by 2002:a05:6512:1042:b0:4a2:46f6:6cee with SMTP id c2-20020a056512104200b004a246f66ceemr2371623lfb.642.1669105961476; Tue, 22 Nov 2022 00:32:41 -0800 (PST) Received: from milin-wrk.rasu.local ([178.70.40.200]) by smtp.gmail.com with ESMTPSA id q23-20020ac246f7000000b004a27d2ea029sm2406419lfo.172.2022.11.22.00.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 00:32:40 -0800 (PST) From: Mikhail Ilin To: u-boot@lists.denx.de Cc: Mikhail Ilin Subject: [PATCH] tools: mkimage: Fix nullptr at strchr() The 'file' pointer can be null. Thus, before using it in the strchr() function, you need to make sure that it is not null. Date: Tue, 22 Nov 2022 11:32:37 +0300 Message-Id: <20221122083237.9296-1-ilin.mikhail.ol@gmail.com> X-Mailer: git-send-email 2.17.1 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 Fixes: 0b0c6af38738 ("Prepare v2020.01") Signed-off-by: Mikhail Ilin --- tools/mkimage.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/mkimage.c b/tools/mkimage.c index 5f51d2cc89..95005d8414 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -509,6 +509,8 @@ int main(int argc, char **argv) file = params.datafile; for (;;) { + if (!file) + break; char *sep = strchr(file, ':'); if (sep) { *sep = '\0'; -- 2.17.1