Drop "tools/lib/api/fs/fs.c: Fix misuse of strncpy()"
This commit is contained in:
parent
4eebdc341f
commit
c9a94477f2
|
@ -1049,6 +1049,7 @@ linux (4.19.106-1) UNRELEASED; urgency=medium
|
|||
local_irq_save()" for context changes in 4.19.104.
|
||||
* [rt] Refresh "arm64: fpsimd: use preemp_disable in addition to
|
||||
local_bh_disable()" for context changes in 4.19.105.
|
||||
* Drop "tools/lib/api/fs/fs.c: Fix misuse of strncpy()"
|
||||
|
||||
[ Ben Hutchings ]
|
||||
* [x86] Drop "Add a SysRq option to lift kernel lockdown" (Closes: #947021)
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
From: Ben Hutchings <ben@decadent.org.uk>
|
||||
Date: Thu, 19 Jul 2018 23:36:52 +0100
|
||||
Subject: tools/lib/api/fs/fs.c: Fix misuse of strncpy()
|
||||
Bug-Debian: https://bugs.debian.org/897802
|
||||
Forwarded: https://lore.kernel.org/lkml/20180721021026.GQ14131@decadent.org.uk/T/
|
||||
|
||||
gcc 8 reports:
|
||||
|
||||
In function 'fs__env_override',
|
||||
inlined from 'fs__get_mountpoint' at fs/fs.c:228:6:
|
||||
fs/fs.c:222:2: error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]
|
||||
strncpy(fs->path, override_path, sizeof(fs->path));
|
||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
I'm not convinced it makes sense to truncate the copied string here,
|
||||
but since we're already doing so let's ensure it's still null-
|
||||
terminated. Use strlcpy() instead.
|
||||
|
||||
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
---
|
||||
Index: linux/tools/lib/api/fs/fs.c
|
||||
===================================================================
|
||||
--- linux.orig/tools/lib/api/fs/fs.c
|
||||
+++ linux/tools/lib/api/fs/fs.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mount.h>
|
||||
+#include <linux/string.h>
|
||||
|
||||
#include "fs.h"
|
||||
#include "debug-internal.h"
|
||||
@@ -219,7 +220,7 @@ static bool fs__env_override(struct fs *
|
||||
return false;
|
||||
|
||||
fs->found = true;
|
||||
- strncpy(fs->path, override_path, sizeof(fs->path));
|
||||
+ strlcpy(fs->path, override_path, sizeof(fs->path));
|
||||
return true;
|
||||
}
|
||||
|
|
@ -166,7 +166,6 @@ bugfix/all/tools-build-remove-bpf-run-time-check-at-build-time.patch
|
|||
bugfix/all/cpupower-bump-soname-version.patch
|
||||
bugfix/all/libcpupower-hide-private-function.patch
|
||||
bugfix/all/cpupower-fix-checks-for-cpu-existence.patch
|
||||
bugfix/all/tools-lib-api-fs-fs.c-fix-misuse-of-strncpy.patch
|
||||
bugfix/all/usbip-fix-misuse-of-strncpy.patch
|
||||
bugfix/x86/tools-turbostat-Add-checks-for-failure-of-fgets-and-.patch
|
||||
bugfix/all/libbpf-add-soname-to-shared-object.patch
|
||||
|
|
Loading…
Reference in New Issue