summaryrefslogtreecommitdiff
path: root/libdm/libdm-common.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2014-08-29 11:52:45 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2014-08-29 13:10:18 +0200
commit93e9b3a1d142b3fcef3866599f8e395636a25ddb (patch)
tree50420978dc621346679c4f58d9446e463b9920f4 /libdm/libdm-common.c
parent2faf416e0ed639b453c4ccf0d7f6f0217b644d5d (diff)
downloadlvm2-93e9b3a1d142b3fcef3866599f8e395636a25ddb.tar.gz
libdm: revert incorrect path length size for sscanf
Commit 94786a3bbf0b68883a2618c9bc25fc88e367f9f8 introduced another bug - since sscanf needs extra 1 byte for \0. Since there is no easy way to do a macro evaluation for (PATH_MAX-1) and string concatation of this number to get resulting (%4095s) - let's go with easiest path and restore extra byte for 0. Other option would be to prepare sscanf parsing string in runtime. But lets resolve it when we look at PATH_MAX handling later...
Diffstat (limited to 'libdm/libdm-common.c')
-rw-r--r--libdm/libdm-common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index bfa60a2d6..bd51645eb 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1649,8 +1649,8 @@ static void _unmangle_mountinfo_string(const char *src, char *buf)
/* Parse one line of mountinfo and unmangled target line */
static int _mountinfo_parse_line(const char *line, unsigned *maj, unsigned *min, char *buf)
{
- char root[PATH_MAX];
- char target[PATH_MAX];
+ char root[PATH_MAX + 1]; /* sscanf needs extra '\0' */
+ char target[PATH_MAX + 1];
/* TODO: maybe detect availability of %ms glib support ? */
if (sscanf(line, "%*u %*u %u:%u %" DM_TO_STRING(PATH_MAX)