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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3FC5F138AE9 for ; Fri, 29 Dec 2017 11:45:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 431B6E0EB7; Fri, 29 Dec 2017 11:45:14 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1A7C0E0EB7 for ; Fri, 29 Dec 2017 11:45:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 996BE33D3C7 for ; Fri, 29 Dec 2017 11:45:11 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2D187AFCC for ; Fri, 29 Dec 2017 11:45:10 +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: <1514477574.e5ed806b4a2784ced621efd8c5b036bddef780f8.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/atom_explode.c X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: e5ed806b4a2784ced621efd8c5b036bddef780f8 X-VCS-Branch: master Date: Fri, 29 Dec 2017 11:45:10 +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-Archives-Salt: cf17ee16-7184-4f5d-87c3-c05551dc4960 X-Archives-Hash: aad2542ba56e059cfc6910a8bc0ae1c8 commit: e5ed806b4a2784ced621efd8c5b036bddef780f8 Author: Fabian Groffen gentoo org> AuthorDate: Thu Dec 28 16:12:54 2017 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Thu Dec 28 16:12:54 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e5ed806b atom_explode: be more careful with eating suffix letters Make sure we don't just eat a char at the end of the atom, because if that char appears after a -, it will be seen as version part. An example is xerces-c, where the parsed atom form would just be xerces. Bug: https://bugs.gentoo.org/638816 libq/atom_explode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libq/atom_explode.c b/libq/atom_explode.c index 956ac49..057bfa1 100644 --- a/libq/atom_explode.c +++ b/libq/atom_explode.c @@ -218,9 +218,12 @@ atom_explode(const char *atom) ret->suffixes[idx] = t; } - /* allow for 1 optional suffix letter */ + /* allow for 1 optional suffix letter, must be following a number + * otherwise we eat stuff like -c, see bug #639978 */ ptr = ret->PN + strlen(ret->PN); - if (ptr[-1] >= 'a' && ptr[-1] <= 'z') { + if (ptr[-1] >= 'a' && ptr[-1] <= 'z' && + ptr - 2 > ret->PN && ptr[-2] >= '0' && ptr[-2] <= '9') + { ret->letter = ptr[-1]; --ptr; }