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
| ||
|
Date: Sun, 27 Jul 2014 00:56:02 +0200 From: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se> To: Peter Zijlstra <a.p.zijlstra@...llo.nl>, Paul Mackerras <paulus@...ba.org> Cc: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>, Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Stanislav Fomichev <stfomichev@...dex-team.ru>, Namhyung Kim <namhyung@...nel.org>, Jiri Olsa <jolsa@...nel.org>, Rusty Russell <rusty@...tcorp.com.au>, Borislav Petkov <bp@...e.de>, linux-kernel@...r.kernel.org Subject: [PATCH] tools: perf: util: svghelper.c: Cleaning up missing null-terminate in conjunction with strncpy Ensures that the string is null-terminate in connection with the use of strncpy. And removed unnecessary magic numbers. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se> --- tools/perf/util/svghelper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index 6a0a13d..82aec8f 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c @@ -257,7 +257,8 @@ static char *cpu_model(void) if (file) { while (fgets(buf, 255, file)) { if (strstr(buf, "model name")) { - strncpy(cpu_m, &buf[13], 255); + strncpy(cpu_m, &buf[13], sizeof(cpu_m)); + cpu_m[sizeof(cpu_m) - 1] = '\0'; break; } } -- 1.7.10.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