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>] [day] [month] [year] [list]
Message-ID: <tip-g2uoiwbrpiimb63rx32qv8ne@git.kernel.org>
Date:	Thu, 23 Jan 2014 09:04:08 -0800
From:	tip-bot for Alan Cox <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	acme@...hat.com, linux-kernel@...r.kernel.org,
	alan@...ux.intel.com, hpa@...or.com, mingo@...nel.org,
	peterz@...radead.org, gnomes@...rguk.ukuu.org.uk,
	tglx@...utronix.de
Subject: [tip:perf/urgent] perf tools: Ensure sscanf does not overrun the 
 "mem" field

Commit-ID:  a761a2d8a7175b7b4e8525e0672e1a8d3c051001
Gitweb:     http://git.kernel.org/tip/a761a2d8a7175b7b4e8525e0672e1a8d3c051001
Author:     Alan Cox <alan@...ux.intel.com>
AuthorDate: Mon, 20 Jan 2014 19:10:11 +0100
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 20 Jan 2014 16:19:08 -0300

perf tools: Ensure sscanf does not overrun the "mem" field

Make the parsing robust.

(perf has some other assumptions that BUFSIZE <= MAX_PATH which are
 not touched here)

Reported-by: Jackie Chang
Signed-off-by: Alan Cox <alan@...ux.intel.com>
Cc: Alan Cox <gnomes@...rguk.ukuu.org.uk>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/n/tip-g2uoiwbrpiimb63rx32qv8ne@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/util/header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index bb3e0ed..893f8e2 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -930,7 +930,7 @@ static int write_topo_node(int fd, int node)
 		/* skip over invalid lines */
 		if (!strchr(buf, ':'))
 			continue;
-		if (sscanf(buf, "%*s %*d %s %"PRIu64, field, &mem) != 2)
+		if (sscanf(buf, "%*s %*d %31s %"PRIu64, field, &mem) != 2)
 			goto done;
 		if (!strcmp(field, "MemTotal:"))
 			mem_total = mem;
--
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