linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mbuesch@freenet.de>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH, UDEV] change no_trailing_slash() to remove all trailing slashes
Date: Sat, 05 Feb 2005 17:18:49 +0000	[thread overview]
Message-ID: <200502051818.54277.mbuesch@freenet.de> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 262 bytes --]

Hi,

This changes no_trailing_slash() to remove all trailing slashes
and not just the last one.
This protects against crazy users which do:
export SYSFS_PATH="/sys//"
or something similiar.

-- 
Regards Michael Buesch  [ http://www.tuxsoft.de.vu ]



[-- Attachment #1.2: udev_no_trailing_slash.diff --]
[-- Type: text/x-diff, Size: 414 bytes --]

===== udev_utils.c 1.25 vs edited =====
--- 1.25/udev_utils.c	2004-12-20 22:10:57 +01:00
+++ edited/udev_utils.c	2005-02-05 18:13:46 +01:00
@@ -200,11 +200,11 @@
 
 void no_trailing_slash(char *path)
 {
-	int len;
+	size_t len;
 
 	len = strlen(path);
-	if (len > 0 && path[len-1] == '/')
-		path[len-1] = '\0';
+	while (len > 0 && path[len-1] == '/')
+		path[--len] = '\0';
 }
 
 struct files {

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2005-02-05 17:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-05 17:18 Michael Buesch [this message]
2005-02-05 18:15 ` [PATCH, UDEV] change no_trailing_slash() to remove all Kay Sievers
2005-02-05 22:04 ` [PATCH, UDEV] change no_trailing_slash() to remove all trailing Paul Jackson
2005-02-05 22:36 ` [PATCH, UDEV] change no_trailing_slash() to remove all trailing slashes Michael Buesch
2005-02-06  1:11 ` [PATCH, UDEV] change no_trailing_slash() to remove all trailing Paul Jackson
2005-02-06  9:54 ` [PATCH, UDEV] change no_trailing_slash() to remove all trailing slashes Michael Buesch

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=200502051818.54277.mbuesch@freenet.de \
    --to=mbuesch@freenet.de \
    --cc=linux-hotplug@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).