Re: msdos_format_name() bug?
From: OGAWA Hirofumi
Date: Mon Feb 02 2009 - 11:09:40 EST
Roel Kluin <roel.kluin@xxxxxxxxx> writes:
> in msdos_format_name(const unsigned char *name, int len, ...)
>
> name is the proposed name, len is its length.
>
> while (c != '.' && len--)
> c = *name++;
> if (c == '.') {
> while (walk - res < 8)
> *walk++ = ' ';
> while (len > 0 && walk - res < MSDOS_NAME) {
>
> Is the postfix decrement in the first loop correct, or should it be
> prefix? (isn't that one character too many?)
>
> If not, note that if the proposed name ends with a dot: e.g.
> 'myfile.' the first while loop iterates until the dot which ends
> the loop, but because of the postfix decrement len already is 0,
> so the third while loop won't start. Is that correct?
In the "myfile." case, it seems correct. It will provide "MYFILE ".
--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/