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-next>] [day] [month] [year] [list]
Date:	Fri, 13 Mar 2015 08:41:32 +0000
From:	Wang Nan <wangnan0@...wei.com>
To:	<acme@...nel.org>, <namhyung@...nel.org>, <jolsa@...nel.org>
CC:	<linux-kernel@...r.kernel.org>, <mingo@...hat.com>,
	<lizefan@...wei.com>, <pi3orama@....com>
Subject: [PATCH] perf: fix a segfault problem.

Without this patch, perf report cause segfault if pass "" as '-t':

  $ perf report -t ""

    # To display the perf.data header info, please use --header/--header-only options.
    #
    # Samples: 37  of event 'syscalls:sys_enter_write'
    # Event count (approx.): 37
    #
    # Children    SelfCommand   Shared Object         Symbol
    Segmentation fault

This patch avoid the segfault by checking empty string for
'symbol_conf.field_sep'.

Signed-off-by: Wang Nan <wangnan0@...wei.com>
---
 tools/perf/util/sort.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 4593f36..7f563a0 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -31,7 +31,8 @@ static int repsep_snprintf(char *bf, size_t size, const char *fmt, ...)
 
 	va_start(ap, fmt);
 	n = vsnprintf(bf, size, fmt, ap);
-	if (symbol_conf.field_sep && n > 0) {
+	if (symbol_conf.field_sep && n > 0 &&
+			(symbol_conf.field_sep[0] != '\0')) {
 		char *sep = bf;
 
 		while (1) {
-- 
1.8.3.4

--
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