From 664df13033097c85531857a6ce5a1d2865a72655 Mon Sep 17 00:00:00 2001 From: avatar Date: Fri, 25 Nov 2005 19:55:14 +0000 Subject: 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 --- sbin/mount_msdosfs/mount_msdosfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sbin/mount_msdosfs') diff --git a/sbin/mount_msdosfs/mount_msdosfs.c b/sbin/mount_msdosfs/mount_msdosfs.c index 962f708..0d086a2 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) -- cgit v1.1