aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/mount_msdosfs
diff options
context:
space:
mode:
authorTai-hwa Liang <avatar@FreeBSD.org>2005-11-25 19:55:14 +0000
committerTai-hwa Liang <avatar@FreeBSD.org>2005-11-25 19:55:14 +0000
commit6a604ed4fb00cb137568dcf4b307aa7aea7312c7 (patch)
tree918ee7bfb4445b508f4e74f497d433dddc6c2e52 /sbin/mount_msdosfs
parent4acc9672b54462c12a5beacf13b37cba85d8606c (diff)
downloadsrc-6a604ed4fb00cb137568dcf4b307aa7aea7312c7.tar.gz
src-6a604ed4fb00cb137568dcf4b307aa7aea7312c7.zip
It turns out that set_charset() invokes build_iovec_argf() which modifies
iov address internally through realloc(3). However, since the function parameter wasn't designed to allow the modified iov being passed back to the caller, we ended up feeding iov with several corrupted entries(this depends on how many arguments were pushed into iovec before set_charset()) to nmount(2). This commit fixes this regression introduced in rev1.37 such that mount_msdosfs(8) with code page conversion option(-W,-D) enabled works again. Reviewed by: rodrigc
Notes
Notes: svn path=/head/; revision=152809
Diffstat (limited to 'sbin/mount_msdosfs')
-rw-r--r--sbin/mount_msdosfs/mount_msdosfs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/mount_msdosfs/mount_msdosfs.c b/sbin/mount_msdosfs/mount_msdosfs.c
index 962f70869ca0..0d086a2fa673 100644
--- a/sbin/mount_msdosfs/mount_msdosfs.c
+++ b/sbin/mount_msdosfs/mount_msdosfs.c
@@ -69,7 +69,7 @@ static gid_t a_gid(char *);
static uid_t a_uid(char *);
static mode_t a_mask(char *);
static void usage(void) __dead2;
-static int set_charset(struct iovec *iov, int *iovlen, const char *, const char *);
+static int set_charset(struct iovec **iov, int *iovlen, const char *, const char *);
int
main(int argc, char **argv)
@@ -187,12 +187,12 @@ main(int argc, char **argv)
dir = argv[optind + 1];
if (cs_local != NULL) {
- if (set_charset(iov, &iovlen, cs_local, cs_dos) == -1)
+ if (set_charset(&iov, &iovlen, cs_local, cs_dos) == -1)
err(EX_OSERR, "msdosfs_iconv");
build_iovec_argf(&iov, &iovlen, "kiconv", "");
} else if (cs_dos != NULL) {
build_iovec_argf(&iov, &iovlen, "cs_local", "ISO8859-1");
- if (set_charset(iov, &iovlen, "ISO8859-1", cs_dos) == -1)
+ if (set_charset(&iov, &iovlen, "ISO8859-1", cs_dos) == -1)
err(EX_OSERR, "msdosfs_iconv");
build_iovec_argf(&iov, &iovlen, "kiconv", "");
}
@@ -300,7 +300,7 @@ usage()
}
int
-set_charset(struct iovec *iov, int *iovlen, const char *cs_local, const char *cs_dos)
+set_charset(struct iovec **iov, int *iovlen, const char *cs_local, const char *cs_dos)
{
int error;
@@ -310,7 +310,7 @@ set_charset(struct iovec *iov, int *iovlen, const char *cs_local, const char *cs
return (-1);
}
- build_iovec_argf(&iov, iovlen, "cs_win", ENCODING_UNICODE);
+ build_iovec_argf(iov, iovlen, "cs_win", ENCODING_UNICODE);
error = kiconv_add_xlat16_cspairs(ENCODING_UNICODE, cs_local);
if (error)
return (-1);
@@ -319,7 +319,7 @@ set_charset(struct iovec *iov, int *iovlen, const char *cs_local, const char *cs
if (error)
return (-1);
} else {
- build_iovec_argf(&iov, iovlen, "cs_dos", cs_local);
+ build_iovec_argf(iov, iovlen, "cs_dos", cs_local);
error = kiconv_add_xlat16_cspair(cs_local, cs_local,
KICONV_FROM_UPPER | KICONV_LOWER);
if (error)