From patchwork Tue Nov 26 14:45:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 845605 Delivered-To: patch@linaro.org Received: by 2002:a5d:6989:0:b0:382:43a8:7b94 with SMTP id g9csp256287wru; Tue, 26 Nov 2024 06:45:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWQF1cwUsJTIT2F2j0G80Ooh6Cf3EeOioESfnnYyiFyImxAenrZNIv7KEm8fXSW42ygfFUFrw==@linaro.org X-Google-Smtp-Source: AGHT+IFSGS+/RBfDVy3eta5eJzw3/xRXhLlOgDFKC1QGeuRQymBQj/Hru1xrwYwyj507JKoKGiaN X-Received: by 2002:a17:906:3194:b0:aa5:274b:60ee with SMTP id a640c23a62f3a-aa5274b69famr1371139666b.39.1732632332040; Tue, 26 Nov 2024 06:45:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732632332; cv=none; d=google.com; s=arc-20240605; b=N1ZiZTV+wiiJml5Ebu7JA13V3QSc5X7vRVfw7r4VV34hKO0pl4eVcn77iAlOj0JLet A7/ETOg74l4xDEyRjySRk1PmEab1T4g3dYsM2qz1vyP8hXy9UUk8QFTraye5BRwLFHFt 9UdIg8JU9QwxYRGrLokBNKEWezPMPFZYxxP3hrtw6Lp8ojstm1LGDg+251uL5KRnBsx/ sTWLCuLS9m2Z08DaXGnBeDdhZ/7hJeZ8zzpGWVoYGxokHt1QQy8VoXXZFcpYtNw80bLD gsn1j/zf/mPpkD9z/rV/9Gt86fk78dFrtsaEPKeyzvAGwOHoElm6Dxqmt38Wgej2ER0H eSYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=QeRR32QADWCZ+aoxZbvsQewxa+eh8ZGkU57utxJF+WQ=; fh=/qhhwBUWtDBN3ed9ApA+FYQTZezhDj9h96rtJpekdzk=; b=kxyDL227tcAq66dVq5N/76IXZXjxoxMMWFBRHBxN9gwXVnvQAizjfCGBjvujT4z9Ru vNZ3k5EVkSIog/nLc5ZJVRbRGLQfqwE3xFNgRyTHUPeB3XvJ/4Q2rE4qtUrSRLJdVak2 GxCvdLszad4BBli5P5NoUOWYHSsd0vc74WLG/kthQokvAandLbtMZGRzC4Id+ZVzXepJ SzWBEcoyrBXhWAxT26sKkCRBr+I5rgNC/IIBwiU8FE4z7OMSXNJpAeKN4AckR97KA6k+ 3U9xtOrPypfceroPE9Sd9s6q3PgSRck7DEAc3R8inNG0y9XMzPuTVgyE61WqEYSl97zU zH3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zLqQBk6o; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa57a93f694si25111066b.358.2024.11.26.06.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 06:45:32 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zLqQBk6o; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F34B388DEA; Tue, 26 Nov 2024 15:45:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="zLqQBk6o"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BABDE88DF1; Tue, 26 Nov 2024 15:45:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 AF48E88360 for ; Tue, 26 Nov 2024 15:45:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-434a852bb6eso3928115e9.3 for ; Tue, 26 Nov 2024 06:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732632327; x=1733237127; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QeRR32QADWCZ+aoxZbvsQewxa+eh8ZGkU57utxJF+WQ=; b=zLqQBk6ou1sRAY9w7W6bZDEnbk96HdrCppv3mCCwMfSOWDeDj/UpWFsonRn6q1A7dp E1Rs7MimhADPwPiyzCG1GyykpIXrG09kRKYhDlquTkJ8kzlPBJIg+4lNLEwbc6Js5SZy oLRF2NQ+RbUhAbOClDDR3tkXXxoKvbNqNAw9fOlHjKr/fPdcQa5peIn9URGJJDFw/wwp 6dN5VqXI3xx+aUh7/MSwAbbKszPXcb/K4kaXWn3IrQy6wjIIly1UdfEWjfbWhwO//0cV cJz8sLxHt7FyuHqZ/0hz+a4e2KbEKxgkA1RzZDim1AFcNZKbgcpSgTm8TJeXyCZq1n3o 9ggA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732632327; x=1733237127; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QeRR32QADWCZ+aoxZbvsQewxa+eh8ZGkU57utxJF+WQ=; b=VYwp9TYNX4A/ZjyQcy/x6NhOmaO3Dprt8ObBSw1xeXDIE/dJLxZNuaDdt3q6K+Z2uW /T1I7uFohSh5ZM/9k6gaVQh8EJ92XfH+6/0QD4/1mS+PPhRSQS7F/6lhdJ+PEOKkOq+x feSQth4vS2xXeqT6QBe/E6FAaQ8T35feojpEUuk2d1mbtbOFK4s6Hu0yyBfDsY/oZn6E 2LjkYfvWYjFfdCI21jGQsOJ7zvqoZSf/1bwp+DnXDV+AHpeL8OKvESKLLUPFs5TBaA7w ZgiU5VW0rjC/eU32BPCPGaX7/0jsKA5GD9gmrHI05ls1iDTxiZl3o+AZl//yGgT4fRXl Y3aQ== X-Gm-Message-State: AOJu0YxGfn6433x5+vNx9qnSrNiFC1J2kKhL/zU2Pkjh7c93OIuWTL0A Hn0pl+IuEwS+SIez8rX9T8Fxn2OXDkuW3pkmp97e7w7Tr+Y8t6fHS3I4mEX/Eif1mt+LqtXfQ/C Ynro= X-Gm-Gg: ASbGncv2p/c7+aXk+iYhfUX4QuT2E5suVhq0q3KTnda6FsL29exIEckwKVyJfAKHF+9 CMJvlvZEMcxxCF/ziLLPKAJWp7ruFTe8OEKk2Apb9YWrWrPNUX8Gi+5r0PmganrdmAw+dYd99vy 8ntIboWW7zAP1wyHGlR7TW8OqEnL2MA/wht/sCNdmNUS3pXGRCo98BHsWDLeKXwdpS2u2mX32km 9ejYE9sB6EjWjEJ2XmmJlLao2Wjx5Tq4DQbNvty6GgJxaOKQ2+apEi4Xw== X-Received: by 2002:a05:600c:4f86:b0:431:5632:448b with SMTP id 5b1f17b1804b1-433ce48eb82mr133462375e9.25.1732632326724; Tue, 26 Nov 2024 06:45:26 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:d868:8373:c88:a797]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4349f9eca01sm74615135e9.29.2024.11.26.06.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 06:45:26 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Jerome Forissier , Tom Rini , Joe Hershberger , Ramon Fried , Ilias Apalodimas , Simon Glass , Heinrich Schuchardt Subject: [PATCH] net: lwip: wget: fix legacy syntax Date: Tue, 26 Nov 2024 15:45:06 +0100 Message-ID: <20241126144508.501779-1-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Commit 356011f7ac25 ("lwip: fix code style issues") has inadvertently broken the support for the legacy syntax: => wget 192.168.0.16:test.bin invalid uri, no file path Invalid URL. Use http(s):// The reason is two calls to strncpy() were replaced by strlcpy() without paying attention to the fact that they are not equivalent in the present case. Since we are using a character counter (n) and since we do not depend on having a properly null-terminated string at each step in the parsing, strlcpy() is not justified and strncpy() is the right tool for the job. So use it again. Reported-by: Tom Rini Signed-off-by: Jerome Forissier --- net/lwip/wget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/lwip/wget.c b/net/lwip/wget.c index 062aa7c44f0..5501ffdd004 100644 --- a/net/lwip/wget.c +++ b/net/lwip/wget.c @@ -161,7 +161,7 @@ static int parse_legacy_arg(char *arg, char *nurl, size_t rem) if (rem < n) return -1; - strlcpy(p, server, n); + strncpy(p, server, n); p += n; rem -= n; if (rem < 1) @@ -172,7 +172,7 @@ static int parse_legacy_arg(char *arg, char *nurl, size_t rem) n = strlen(path); if (rem < n) return -1; - strlcpy(p, path, n); + strncpy(p, path, n); p += n; rem -= n; if (rem < 1)