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 41A30138350 for ; Mon, 20 Jan 2020 19:54:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6A9D7E08BD; Mon, 20 Jan 2020 19:54:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 4B638E08BD for ; Mon, 20 Jan 2020 19:54:20 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 103FF34E309 for ; Mon, 20 Jan 2020 19:54:19 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 20898B0 for ; Mon, 20 Jan 2020 19:54:17 +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: <1579550027.981f0a47acc281bcfec4faa966d0bfb447b28ddd.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/colors.c X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 981f0a47acc281bcfec4faa966d0bfb447b28ddd X-VCS-Branch: master Date: Mon, 20 Jan 2020 19:54:17 +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: 37ec9e5a-25f7-4d0d-bc82-5a9072bbc152 X-Archives-Hash: 5542befebc6e0a28d611c62a27ed63fe commit: 981f0a47acc281bcfec4faa966d0bfb447b28ddd Author: Fabian Groffen gentoo org> AuthorDate: Mon Jan 20 19:53:47 2020 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Mon Jan 20 19:53:47 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=981f0a47 libq/colors: fix Coverity 183476 Buffer not null terminated Signed-off-by: Fabian Groffen gentoo.org> libq/colors.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libq/colors.c b/libq/colors.c index 88664c3..9a48e2e 100644 --- a/libq/colors.c +++ b/libq/colors.c @@ -102,8 +102,9 @@ color_remap(void) int found = 0; for (n = 0; n < ARRAY_SIZE(color_pairs); n++) { if (strcmp(color_pairs[n].name, p) == 0) { - strncpy(color_pairs[i].value, - color_pairs[n].origval, CPAIR_VALUE_LEN); + snprintf(color_pairs[i].value, + sizeof(color_pairs[i].value), + "%s", color_pairs[n].origval); found = 1; break; } @@ -111,7 +112,7 @@ color_remap(void) if (!found) snprintf(color_pairs[i].value, - sizeof(color_pairs[i].origval), "\e[%s", p); + sizeof(color_pairs[i].value), "\e[%s", p); } } }