From 983a72dab9564ca3a344c0d28ffc98d8756c62dc Mon Sep 17 00:00:00 2001 From: Gerald Schaefer Date: Tue, 20 Feb 2018 19:27:11 +0100 Subject: [PATCH] hmcdrvfs: fix parsing of link count >= 1000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hmcdrvfs will ignore files with a link count >= 1000, due to an inconsistency in the input data. The parsing code relies on having spaces between the different fields in its input data. When a file has a link count >= 1000, there will be no space, and the "link count" field will be placed directly after the previous "mode" field. This will confuse the parser, and all such files will not be accesible. The "mode" field will never contain digits, so in order to fix this issue, the parser can recognize the "link count" field by the presence of a digit. Signed-off-by: Gerald Schaefer Signed-off-by: Jan Höppner --- CHANGELOG.md | 1 + hmcdrvfs/hmcdrvfs.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc04564d..dd624761 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Release history for s390-tools (MIT version) - dbginfo: Gather nvme related data Bug Fixes: + - hmcdrvfs: fix parsing of link count >= 1000 * __v2.3.0 (2018-01-30)__ diff --git a/hmcdrvfs/hmcdrvfs.c b/hmcdrvfs/hmcdrvfs.c index f49fbba5..3cf10056 100644 --- a/hmcdrvfs/hmcdrvfs.c +++ b/hmcdrvfs/hmcdrvfs.c @@ -821,10 +821,13 @@ static char *hmcdrv_parse_line(char *line, char *namebuf, if ((*line != '\0') && (*line != '\n')) { field = hmcdrv_parse_ntoken(field, line, &attr); - while ((*line != '\0') && - (*line != '\n') && - !isspace(*line)) + while ((*line != '\0') && (*line != '\n')) { + if (isspace(*line)) + break; + if (field == 1 && isdigit(*line)) + break; ++line; /* search end of field */ + } } } /* while */