On Wed, Jan 28, 2004 at 07:56:39AM -0700, Greg J. wrote: > Is this happening to anyone else? ... > localhost# touch testing > localhost# ls -l test* > -rwxr-xr-x 1 root wheel 0 Jan 28 07:35 testingg ... > localhost# uname -a > FreeBSD localhost.bsd-unix.org 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Mon > Jan 26 17:14:28 MST 2004 > cas_at_localhost.bsd-unix.org:/usr/obj/usr/src/sys/CASX64 amd64 Try this patch. I'm pretty sure that the problem is that an int * is bogusly cast to a size_t * in a few places in msdosfs_conv.c, but I don't have an amd64 system myself, so I haven't been able to test it. Index: direntry.h =================================================================== RCS file: /home/ncvs/src/sys/fs/msdosfs/direntry.h,v retrieving revision 1.19 diff -u -u -r1.19 direntry.h --- direntry.h 26 Dec 2003 17:24:37 -0000 1.19 +++ direntry.h 31 Jan 2004 15:22:11 -0000 _at__at_ -144,14 +144,14 _at__at_ void dos2unixtime(u_int dd, u_int dt, u_int dh, struct timespec *tsp); int dos2unixfn(u_char dn[11], u_char *un, int lower, struct msdosfsmount *pmp); -int unix2dosfn(const u_char *un, u_char dn[12], int unlen, u_int gen, +int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen, struct msdosfsmount *pmp); -int unix2winfn(const u_char *un, int unlen, struct winentry *wep, int cnt, +int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, int chksum, struct msdosfsmount *pmp); -int winChkName(const u_char *un, int unlen, int chksum, +int winChkName(const u_char *un, size_t unlen, int chksum, struct msdosfsmount *pmp); int win2unixfn(struct winentry *wep, int chksum, struct msdosfsmount *pmp); u_int8_t winChksum(u_int8_t *name); -int winSlotCnt(const u_char *un, int unlen, struct msdosfsmount *pmp); -int winLenFixup(const u_char *un, int unlen); +int winSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp); +size_t winLenFixup(const u_char *un, size_t unlen); #endif /* _KERNEL */ Index: msdosfs_conv.c =================================================================== RCS file: /home/ncvs/src/sys/fs/msdosfs/msdosfs_conv.c,v retrieving revision 1.36 diff -u -u -r1.36 msdosfs_conv.c --- msdosfs_conv.c 26 Dec 2003 17:24:37 -0000 1.36 +++ msdosfs_conv.c 31 Jan 2004 15:21:44 -0000 _at__at_ -95,7 +95,7 _at__at_ static u_short lastddate; static u_short lastdtime; -static int mbsadjpos(const char **, int, int, int, int, void *handle); +static int mbsadjpos(const char **, size_t, size_t, int, int, void *handle); static u_int16_t dos2unixchr(const u_char **, size_t *, int, struct msdosfsmount *); static u_int16_t unix2doschr(const u_char **, size_t *, struct msdosfsmount *); static u_int16_t win2unixchr(u_int16_t, struct msdosfsmount *); _at__at_ -421,7 +421,7 _at__at_ int lower; struct msdosfsmount *pmp; { - int i; + size_t i; int thislong = 0; u_int16_t c; _at__at_ -438,7 +438,7 _at__at_ * Copy the name portion into the unix filename string. */ for (i = 8; i > 0 && *dn != ' ';) { - c = dos2unixchr((const u_char **)&dn, (size_t *)&i, lower, pmp); + c = dos2unixchr((const u_char **)&dn, &i, lower, pmp); if (c & 0xff00) { *un++ = c >> 8; thislong++; _at__at_ -456,7 +456,7 _at__at_ *un++ = '.'; thislong++; for (i = 3; i > 0 && *dn != ' ';) { - c = dos2unixchr((const u_char **)&dn, (size_t *)&i, lower, pmp); + c = dos2unixchr((const u_char **)&dn, &i, lower, pmp); if (c & 0xff00) { *un++ = c >> 8; thislong++; _at__at_ -485,11 +485,12 _at__at_ unix2dosfn(un, dn, unlen, gen, pmp) const u_char *un; u_char dn[12]; - int unlen; + size_t unlen; u_int gen; struct msdosfsmount *pmp; { - int i, j, l; + ssize_t i, j; + int l; int conv = 1; const u_char *cp, *dp, *dp1; u_char gentext[6], *wcp; _at__at_ -531,7 +532,7 _at__at_ * Filenames with some characters are not allowed! */ for (cp = un, i = unlen; i > 0;) - if (unix2doschr(&cp, (size_t *)&i, pmp) == 0) + if (unix2doschr(&cp, &i, pmp) == 0) return 0; /* _at__at_ -569,7 +570,7 _at__at_ else l = unlen - (dp - un); for (cp = dp, i = l, j = 8; i > 0 && j < 11; j++) { - c = unix2doschr(&cp, (size_t *)&i, pmp); + c = unix2doschr(&cp, &i, pmp); if (c & 0xff00) { dn[j] = c >> 8; if (++j < 11) { _at__at_ -606,7 +607,7 _at__at_ * Now convert the rest of the name */ for (i = dp - un, j = 0; un < dp && j < 8; j++) { - c = unix2doschr(&un, (size_t *)&i, pmp); + c = unix2doschr(&un, &i, pmp); if (c & 0xff00) { dn[j] = c >> 8; if (++j < 8) { _at__at_ -701,7 +702,7 _at__at_ int unix2winfn(un, unlen, wep, cnt, chksum, pmp) const u_char *un; - int unlen; + size_t unlen; struct winentry *wep; int cnt; int chksum; _at__at_ -737,21 +738,21 _at__at_ */ end = 0; for (wcp = wep->wePart1, i = sizeof(wep->wePart1)/2; --i >= 0 && !end;) { - code = unix2winchr(&un, (size_t *)&unlen, 0, pmp); + code = unix2winchr(&un, &unlen, 0, pmp); *wcp++ = code; *wcp++ = code >> 8; if (!code) end = WIN_LAST; } for (wcp = wep->wePart2, i = sizeof(wep->wePart2)/2; --i >= 0 && !end;) { - code = unix2winchr(&un, (size_t *)&unlen, 0, pmp); + code = unix2winchr(&un, &unlen, 0, pmp); *wcp++ = code; *wcp++ = code >> 8; if (!code) end = WIN_LAST; } for (wcp = wep->wePart3, i = sizeof(wep->wePart3)/2; --i >= 0 && !end;) { - code = unix2winchr(&un, (size_t *)&unlen, 0, pmp); + code = unix2winchr(&un, &unlen, 0, pmp); *wcp++ = code; *wcp++ = code >> 8; if (!code) _at__at_ -770,11 +771,11 _at__at_ int winChkName(un, unlen, chksum, pmp) const u_char *un; - int unlen; + size_t unlen; int chksum; struct msdosfsmount *pmp; { - int len; + size_t len; u_int16_t c1, c2; u_char *np; struct dirent dirbuf; _at__at_ -804,8 +805,8 _at__at_ * to look up or create files in case sensitive even when * it's a long file name. */ - c1 = unix2winchr((const u_char **)&np, (size_t *)&len, LCASE_BASE, pmp); - c2 = unix2winchr(&un, (size_t *)&unlen, LCASE_BASE, pmp); + c1 = unix2winchr((const u_char **)&np, &len, LCASE_BASE, pmp); + c2 = unix2winchr(&un, &unlen, LCASE_BASE, pmp); if (c1 != c2) return -2; } _at__at_ -928,7 +929,7 _at__at_ int winSlotCnt(un, unlen, pmp) const u_char *un; - int unlen; + size_t unlen; struct msdosfsmount *pmp; { size_t wlen; _at__at_ -939,7 +940,7 _at__at_ if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { wlen = WIN_MAXLEN * 2; wnp = wn; - msdosfs_iconv->conv(pmp->pm_u2w, (const char **)&un, (size_t *)&unlen, &wnp, &wlen); + msdosfs_iconv->conv(pmp->pm_u2w, (const char **)&un, &unlen, &wnp, &wlen); if (unlen > 0) return 0; return howmany(WIN_MAXLEN - wlen/2, WIN_CHARS); _at__at_ -953,10 +954,10 _at__at_ /* * Determine the number of bytes neccesary for Win95 names */ -int +size_t winLenFixup(un, unlen) const u_char* un; - int unlen; + size_t unlen; { for (un += unlen; unlen > 0; unlen--) if (*--un != ' ' && *un != '.') _at__at_ -970,14 +971,14 _at__at_ * inlen or outlen. */ static int -mbsadjpos(const char **instr, int inlen, int outlen, int weight, int flag, void *handle) +mbsadjpos(const char **instr, size_t inlen, size_t outlen, int weight, int flag, void *handle) { char *outp, outstr[outlen * weight + 1]; if (flag & MSDOSFSMNT_KICONV && msdosfs_iconv) { outp = outstr; outlen *= weight; - msdosfs_iconv->conv(handle, instr, (size_t *)&inlen, &outp, (size_t *)&outlen); + msdosfs_iconv->conv(handle, instr, &inlen, &outp, &outlen); return (inlen); }Received on Sat Jan 31 2004 - 06:27:01 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:41 UTC