From: "Søren Holm" <sgh@sgh.dk>
To: util-linux@vger.kernel.org
Cc: "Søren Holm" <sgh@sgh.dk>
Subject: [PATCH] Don't return root if path contains // or ending /
Date: Fri, 26 Sep 2014 18:35:11 +0200 [thread overview]
Message-ID: <1411749311-16666-1-git-send-email-sgh@sgh.dk> (raw)
If the path fx. is /foo/bar/ the initial stripoff will replace the last slash
with \0 and return a pointer to that exact \0 character. The same thing will
happen if the path contains // somewhere.
Signed-off-by: Søren Holm <sgh@sgh.dk>
---
libmount/src/tab.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 011ba54..2b0a343 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -864,7 +864,7 @@ struct libmnt_fs *mnt_table_find_mountpoint(struct libmnt_table *tb,
}
p = stripoff_last_component(mnt);
- if (!p || !*p)
+ if (!p)
break;
} while (mnt && *(mnt + 1) != '\0');
--
2.1.0
next reply other threads:[~2014-09-26 16:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-26 16:35 Søren Holm [this message]
2014-10-01 8:02 ` [PATCH] Don't return root if path contains // or ending / Karel Zak
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=1411749311-16666-1-git-send-email-sgh@sgh.dk \
--to=sgh@sgh.dk \
--cc=util-linux@vger.kernel.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).