diff options
author | krw <krw@openbsd.org> | 2012-09-06 19:06:04 +0000 |
---|---|---|
committer | krw <krw@openbsd.org> | 2012-09-06 19:06:04 +0000 |
commit | e6f855f7a7cafb73415a238ce5cc66cfb52b38bc (patch) | |
tree | a948979a42614451a6acc141260c63fef538d365 /sys/msdosfs/msdosfs_conv.c | |
parent | Avoid modifying argv when building argv for $* and $@ since it will (diff) | |
download | wireguard-openbsd-e6f855f7a7cafb73415a238ce5cc66cfb52b38bc.tar.xz wireguard-openbsd-e6f855f7a7cafb73415a238ce5cc66cfb52b38bc.zip |
Remove the need to occasionally treat dos file names as strings by
using "%.11s" to print them out. Make all dos file names 11 byte
arrays and nuke the attempt to put '\0' at the 12th position of
such an array.
Fixes 'panic: smashed stack in msdosfs_rename.c' reported by
MERHIGI Marcus via tech@.
Tested by MERHIGI Marcus. Suggestions and ok tedu@.
Diffstat (limited to 'sys/msdosfs/msdosfs_conv.c')
-rw-r--r-- | sys/msdosfs/msdosfs_conv.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/msdosfs/msdosfs_conv.c b/sys/msdosfs/msdosfs_conv.c index d3152925d3d..727acd22826 100644 --- a/sys/msdosfs/msdosfs_conv.c +++ b/sys/msdosfs/msdosfs_conv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_conv.c,v 1.14 2009/08/13 22:34:29 jasper Exp $ */ +/* $OpenBSD: msdosfs_conv.c,v 1.15 2012/09/06 19:06:04 krw Exp $ */ /* $NetBSD: msdosfs_conv.c,v 1.24 1997/10/17 11:23:54 ws Exp $ */ /*- @@ -403,7 +403,7 @@ dos2unixfn(u_char dn[11], u_char *un, int lower) * 3 if conversion was successful and generation number was inserted */ int -unix2dosfn(u_char *un, u_char dn[12], int unlen, u_int gen) +unix2dosfn(u_char *un, u_char dn[11], int unlen, u_int gen) { int i, j, l; int conv = 1; @@ -416,7 +416,6 @@ unix2dosfn(u_char *un, u_char dn[12], int unlen, u_int gen) */ for (i = 0; i < 11; i++) dn[i] = ' '; - dn[11] = 0; /* * The filenames "." and ".." are handled specially, since they |