All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olh@suse.de>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] symlink name and possible overflow in create_node()
Date: Tue, 17 Feb 2004 19:00:10 +0000	[thread overview]
Message-ID: <20040217190010.GA9773@suse.de> (raw)


the filename array might overflow if I interpret the strncat man page correctly.

Why does a symlink look like './foo' instead of just 'foo'?

--- ./udev-add.c~       2004-02-16 22:58:24.000000000 +0100
+++ ./udev-add.c        2004-02-17 19:56:56.000000000 +0100
@@ -146,7 +146,7 @@ static int create_node(struct udevice *d
        int tail;

        strncpy(filename, udev_root, sizeof(filename));
-       strncat(filename, dev->name, sizeof(filename));
+       strncat(filename, dev->name, sizeof(filename) - strlen(filename));

        switch (dev->type) {
        case 'b':
@@ -247,8 +247,6 @@ static int create_node(struct udevice *d
                                i++;
                        }

-                       if (linktarget[0] = '\0')
-                               strcpy(linktarget, "./");
                        strcat(linktarget, &dev->name[tail]);

                        /* unlink existing files to ensure that our symlink is created */

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, n√úRNBERG


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

             reply	other threads:[~2004-02-17 19:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-17 19:00 Olaf Hering [this message]
2004-02-17 19:22 ` [PATCH] symlink name and possible overflow in create_node() Johannes Erdfelt
2004-02-17 19:47 ` Kay Sievers
2004-02-18  8:27 ` John L. Fjellstad
2004-02-18 10:08 ` Kay Sievers
2004-02-18 11:03 ` John L. Fjellstad

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=20040217190010.GA9773@suse.de \
    --to=olh@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.