string handling broken in dev_finddir(), bsd/miscfs/devfs/devfs_tree.c
string handling broken in dev_finddir(), bsd/miscfs/devfs/devfs_tree.c
- Subject: string handling broken in dev_finddir(), bsd/miscfs/devfs/devfs_tree.c
- From: Daniel Mack <email@hidden>
- Date: Mon, 17 Mar 2003 19:55:46 +0100
There is a bug in the string handling in dev_finddir(),
bsd/miscfs/devfs/devfs_tree.c
A string is not null terminated, see below.
The bug takes affect when trying to generate a new entry with
devfs_make_node() with a name containg a path component.
The fix is simple, so I post it here:
diff -u -r1.1.1.5 devfs_tree.c
--- devfs_tree.c 26 Feb 2003 03:40:26 -0000 1.1.1.5
+++ devfs_tree.c 17 Mar 2003 16:30:57 -0000
@@ -335,7 +335,9 @@
scan++;
strncpy(component, start, scan - start);
- if (*scan == '/')
+ component[scan-start] = '\0';
+
+ if (*scan == '/')
scan++;
dirent_p = dev_findname(dirnode, component);
Daniel
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.