lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-c97847d2f0eb77c806e650e04d9bbcf79fa05730@git.kernel.org>
Date:	Mon, 8 Apr 2013 08:29:24 -0700
From:	tip-bot for Chen Gang <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, paulus@...ba.org, hpa@...or.com,
	mingo@...nel.org, a.p.zijlstra@...llo.nl, acme@...stprotocols.net,
	gang.chen@...anux.com, tglx@...utronix.de
Subject: [tip:perf/urgent] perf: Fix strncpy() use, always make sure it'
 s NUL terminated

Commit-ID:  c97847d2f0eb77c806e650e04d9bbcf79fa05730
Gitweb:     http://git.kernel.org/tip/c97847d2f0eb77c806e650e04d9bbcf79fa05730
Author:     Chen Gang <gang.chen@...anux.com>
AuthorDate: Mon, 8 Apr 2013 11:48:27 +0800
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Mon, 8 Apr 2013 13:26:55 +0200

perf: Fix strncpy() use, always make sure it's NUL terminated

For NUL terminated string, always make sure that there's '\0' at the end.

In our case we need a return value, so still use strncpy() and
fix up the tail explicitly.

(strlcpy() returns the size, not the pointer)

Signed-off-by: Chen Gang <gang.chen@...anux.com>
Cc: a.p.zijlstra@...llo.nl <a.p.zijlstra@...llo.nl>
Cc: paulus@...ba.org <paulus@...ba.org>
Cc: acme@...stprotocols.net <acme@...stprotocols.net>
Link: http://lkml.kernel.org/r/51623E0B.7070101@asianux.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 kernel/events/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 59412d0..7f0d67e 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4737,7 +4737,8 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
 	} else {
 		if (arch_vma_name(mmap_event->vma)) {
 			name = strncpy(tmp, arch_vma_name(mmap_event->vma),
-				       sizeof(tmp));
+				       sizeof(tmp) - 1);
+			tmp[sizeof(tmp) - 1] = '\0';
 			goto got_name;
 		}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ