From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ymz7YFsu; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 1B2D55A0265 for ; Wed, 08 Apr 2026 23:40:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775684433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RDOnGs2kNYUF8phInIOLn2ba2PlCmqsLVP3h+BBB6K0=; b=Ymz7YFsuPNYQT1d198L725yWyCvmemo4LPYWl7zbaE5bU4wGiLR1Zj9cpAvNTf9sCkPcxs 2MloSAzhG+PrxVyaFBSnqttPD2/uB0jObFVpAnWjvm8cgNVO3sRzENWaKVz5QqLhtZpelY +ZbAmjsw9+lIp0eENtLNEOPMQ363TxI= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-59-J0gw-5-lNgioWUTL4DdBxA-1; Wed, 08 Apr 2026 17:40:31 -0400 X-MC-Unique: J0gw-5-lNgioWUTL4DdBxA-1 X-Mimecast-MFC-AGG-ID: J0gw-5-lNgioWUTL4DdBxA_1775684429 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4837b6f6b93so1224355e9.3 for ; Wed, 08 Apr 2026 14:40:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775684429; x=1776289229; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RDOnGs2kNYUF8phInIOLn2ba2PlCmqsLVP3h+BBB6K0=; b=Ra6bKClKudcTXt8m9eq0omH+ZYIP95sJgl4T4VKkD/k3lkseowmgeX3iQPz2uYSoQT tfSxANAwXB2yKiEJvUvVsX6VX3MHPmAxA0n8S9fZrwE1nXaK+RE2d2JFguIT7l32wmzB x9AFXqEnlxbCEoj7aYmQbv9PoyafQTsm3U00TsKec4mIpGDkZvIxjTAcrZL5L3pyev4q CUsRnSrnV5p9bqKceB9z2ToNF5JDtSgMGIo17kJfyqZeOp3TbBdWIENsi4DKO9pLY3md lqdWjCvdN/OCOFXDB6owL5hW/n8i5b7/UtL23YUDt7myYoXHyVa1GVZkByQVQM5vT2J1 Y8Fg== X-Gm-Message-State: AOJu0YzFO4an6GFWS18c3JUQNWNlplIAMh8u52SFiCBF7sVYR8Xb+GAq BpYlHaUSM8H+K6kSz08ANH17tlS/qdEUfAY6V1l1NEqsOsWGY/U5bY+1ozxqa4TPgDCX0OMHFj2 9a4703qcpqX3cSLgG1JbpqaxpRS53zZI/v1szCQPG2/LZFFXmJZZWXmg1htrcfA== X-Gm-Gg: AeBDiesB0puKTvbNSLPHwsO0IMC+WgxrAr5gzfcKNJzSn2BvTBbirfe55OXZe/+65ay dRd+g5GPIZt6K4vi8irrQlyMrQswZO7tkgT8TmvrENob7atO07al+rFcudGK+xVHHXgyMTJTYiI fiUffWZnyEZKRCBqh6ZsnQ90R0yu3T3xs1QA0CWisPUXsV2GNhy1hvUVUodYRfckSLDKq2BXlUs rN00T0UyJ3hyAy7sioLBjyjZIp4fOfc2E11W9Uo8IIGhKtJDC+EBOqqbL9uxLEXOAEPDohqd+8S W458AHQm+scZ75yjnKvaqTsdwtLOe+S/zfE5U4BhhjRERqffHsFAXTDl3NYmBSRD3XSp/XBqIR8 mOIHyG0NofaIWwLwn+gy3oxdJouXf7lffKpAs3eqGU2ASfN1U7g== X-Received: by 2002:a05:600c:1383:b0:486:af22:4a2a with SMTP id 5b1f17b1804b1-488ccf63860mr15576155e9.7.1775684428936; Wed, 08 Apr 2026 14:40:28 -0700 (PDT) X-Received: by 2002:a05:600c:1383:b0:486:af22:4a2a with SMTP id 5b1f17b1804b1-488ccf63860mr15575965e9.7.1775684428454; Wed, 08 Apr 2026 14:40:28 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488cf9f350asm1445115e9.8.2026.04.08.14.40.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2026 14:40:27 -0700 (PDT) From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 14/18] conf: Rework checking for garbage after a range Message-ID: <20260408234026.70cdaa03@elisabeth> In-Reply-To: <20260407031630.2457081-15-david@gibson.dropbear.id.au> References: <20260407031630.2457081-1-david@gibson.dropbear.id.au> <20260407031630.2457081-15-david@gibson.dropbear.id.au> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Wed, 08 Apr 2026 23:40:27 +0200 (CEST) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ryXBPJzHyP20nYFQJSG21YRf_JbFK7dtOOqjRI25JaU_1775684429 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 6H6TZKZEAI3GRBASEBVQRKASSC4UL64Z X-Message-ID-Hash: 6H6TZKZEAI3GRBASEBVQRKASSC4UL64Z X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, 7 Apr 2026 13:16:26 +1000 David Gibson wrote: > After parsing port ranges conf_ports_spec() checks if we've reached a > chunk delimiter (',') to verify that there isn't extra garbage there. > Rework how we do this to use the recently introduces chunk-end pointer. Nit: introduced > This has two advantages: > > 1) Small, but practical: we don't need to repeat what the valid delimiters > are, that's already handled in the chunk splitting code. > > 2) Large, if theoretical: this will also given an error if port parsing > overruns a chunk boundary. We don't really expect that to happen, but > it would give very confusing behaviour if it did. strtoul(3), on which > parse_port_range() is based does say it may accept thousands separators > based on locale which means can't entirely be sure it will only accept Nit: we can't > strings of digits. > > Signed-off-by: David Gibson > --- > conf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/conf.c b/conf.c > index 1ab1b071..51612047 100644 > --- a/conf.c > +++ b/conf.c > @@ -264,7 +264,7 @@ static void conf_ports_spec(const struct ctx *c, > > if (parse_port_range(p, &p, &xrange)) > goto bad; > - if ((*p != '\0') && (*p != ',')) /* Garbage after the range */ > + if (p != ep) /* Garbage after the range */ > goto bad; > > for (i = xrange.first; i <= xrange.last; i++) > @@ -303,7 +303,7 @@ static void conf_ports_spec(const struct ctx *c, > mapped_range = orig_range; > } > > - if ((*p != '\0') && (*p != ',')) /* Garbage after the ranges */ > + if (p != ep) /* Garbage after the ranges */ > goto bad; > > if (orig_range.first == 0) { -- Stefano