linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] symlink name and possible overflow in create_node()
@ 2004-02-17 19:00 Olaf Hering
  2004-02-17 19:22 ` Johannes Erdfelt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Olaf Hering @ 2004-02-17 19:00 UTC (permalink / raw)
  To: linux-hotplug


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-02-18 11:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-17 19:00 [PATCH] symlink name and possible overflow in create_node() Olaf Hering
2004-02-17 19:22 ` 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

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).