[Bug 631] New: copy a file to char device file /dev/mtd1 make it to be a comon file
bugzilla at busybox.net
bugzilla at busybox.net
Wed Sep 30 05:56:54 UTC 2009
https://bugs.busybox.net/show_bug.cgi?id=631
Host: mandriver2010-x86-64
Target: blackfin BF537 running uClinux
Build: build on 2009-09-30 on mandriver2010-x86-64
Summary: copy a file to char device file /dev/mtd1 make it to be
a comon file
Product: Busybox
Version: 1.15.x
Platform: Other
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P5
Component: Other
AssignedTo: unassigned at busybox.net
ReportedBy: graff.yang at gmail.com
CC: busybox-cvs at busybox.net
Estimated Hours: 0.0
root:/> ls -l /dev/mtd1
crw-rw---- 1 root root 90, 0 Mar 10 15:48 /dev/mtd1
root:/> cp /etc/TZ /dev/mtd1
root:/> ls -l /dev/mtd1
-rw-r--r-- 1 root root 9 Mar 10 15:48 /dev/mtd1
The following patch can fix it,
Index: busybox-1.15.1/libbb/copy_file.c
===================================================================
--- busybox-1.15.1/libbb/copy_file.c (revision 8868)
+++ busybox-1.15.1/libbb/copy_file.c (working copy)
@@ -276,7 +276,7 @@
new_mode = 0666;
// POSIX way is a security problem versus (sym)link attacks
- if (!ENABLE_FEATURE_NON_POSIX_CP) {
+ if (!ENABLE_FEATURE_NON_POSIX_CP ||
!S_ISLNK(dest_stat.st_mode)) {
dst_fd = open(dest, O_WRONLY|O_CREAT|O_TRUNC,
new_mode);
} else { /* safe way: */
dst_fd = open(dest, O_WRONLY|O_CREAT|O_EXCL, new_mode);
busybox-1.14.3 is OK.
http://www.busybox.net/downloads/snapshots/busybox-20090930.tar.bz2 is fail.
--
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list