From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: [iproute PATCH v2 3/7] lib/fs: Fix format string in find_fs_mount()
Date: Thu, 17 Aug 2017 19:09:28 +0200 [thread overview]
Message-ID: <20170817170932.24659-4-phil@nwl.cc> (raw)
In-Reply-To: <20170817170932.24659-1-phil@nwl.cc>
A field width of 4096 allows fscanf() to store that amount of characters
into the given buffer, though that doesn't include the terminating NULL
byte. Decrease the value by one to leave space for it.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
lib/fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/fs.c b/lib/fs.c
index c59ac564581d0..1ff881ecfcd8c 100644
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -45,7 +45,7 @@ static char *find_fs_mount(const char *fs_to_find)
return NULL;
}
- while (fscanf(fp, "%*s %4096s %127s %*s %*d %*d\n",
+ while (fscanf(fp, "%*s %4095s %127s %*s %*d %*d\n",
path, fstype) == 2) {
if (strcmp(fstype, fs_to_find) == 0) {
mnt = strdup(path);
--
2.13.1
next prev parent reply other threads:[~2017-08-17 17:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 17:09 [iproute PATCH v2 0/7] Covscan: Fixes for string termination Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 1/7] ipntable: Make sure filter.name is NULL-terminated Phil Sutter
2017-08-18 9:19 ` David Laight
2017-08-18 10:52 ` Phil Sutter
2017-08-18 16:32 ` David Laight
2017-08-18 16:52 ` Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 2/7] xfrm_state: Make sure alg_name " Phil Sutter
2017-08-17 17:09 ` Phil Sutter [this message]
2017-08-17 17:09 ` [iproute PATCH v2 4/7] lib/inet_proto: Make sure destination buffers are NULL-terminated Phil Sutter
2017-08-18 16:37 ` Stephen Hemminger
2017-08-18 16:55 ` Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 5/7] lnstat_util: Simplify alloc_and_open() a bit Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 6/7] tc/m_xt: Fix for potential string buffer overflows Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 7/7] lib/ll_map: Make sure im->name is NULL-terminated Phil Sutter
2017-08-18 16:33 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170817170932.24659-4-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).