From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 033A5158091 for ; Tue, 14 Jun 2022 06:37:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3890AE086D; Tue, 14 Jun 2022 06:37:00 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1A73AE086D for ; Tue, 14 Jun 2022 06:37:00 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2EAB1341228 for ; Tue, 14 Jun 2022 06:36:59 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 701744F6 for ; Tue, 14 Jun 2022 06:36:57 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1655188535.2100df5c171029d6c347650fdaf098b67df0f059.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: main.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 2100df5c171029d6c347650fdaf098b67df0f059 X-VCS-Branch: master Date: Tue, 14 Jun 2022 06:36:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 649c9da6-d76a-4d78-a48b-a122a180f1d5 X-Archives-Hash: b9b96cec1387bda2926189e5129a8d32 commit: 2100df5c171029d6c347650fdaf098b67df0f059 Author: Fabian Groffen gentoo org> AuthorDate: Tue Jun 14 06:35:35 2022 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Tue Jun 14 06:35:35 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=2100df5c main: ensure correct parsing of key-value pairs in ini-files Ensure the key is terminated when the '=' is adjacent to it (without whitespace). Bug: https://bugs.gentoo.org/851138 Signed-off-by: Fabian Groffen gentoo.org> main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 1337cb0..809a085 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2021 Gentoo Foundation + * Copyright 2005-2022 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 * * Copyright 2005-2008 Ned Ludd - @@ -747,7 +747,8 @@ read_one_repos_conf(const char *repos_conf, char **primary) repo = NULL; for (p = strtok_r(buf, "\n", &s); p != NULL; p = strtok_r(NULL, "\n", &s)) { - /* trim trailing whitespace, remove comments, locate = */ + /* trim trailing whitespace, remove comments, locate =, walking + * backwards to the front of the string */ do_trim = true; e = NULL; for (r = q = s - 2; q >= p; q--) { @@ -785,7 +786,7 @@ read_one_repos_conf(const char *repos_conf, char **primary) for (r = e - 1; r >= p && isspace((int)*r); r--) *r = '\0'; /* and after the = */ - for (e++; e < q && isspace((int)*e); e++) + for (*e++ = '\0'; e < q && isspace((int)*e); e++) ; if (is_default && strcmp(p, "main-repo") == 0) {