Franck Bui-Huu wrote:
Looking at TTY code, I noticed a weird test done in "opost_bock" located in n_tty.c file. I don't understand why the following test is done at the start of the function: if (nr > sizeof(buf)) nr = sizeof(buf); Actually it limits the size of processing blocks to 4 bytes and I can't find a reason why.
No, it limits the size to 80 bytes, which is the size of buf.
sizeof returns the size of the char array buf[80] (standard C)
Looking at the code, I think Franck is right. buf is a "const unsigned char *" for which sizeof(buf) is the size of a pointer.
This certainly looks like a bug.
Since the function doesn't guarantee that nr bytes are written, and the caller must handle the case of fewer bytes, this probably went unnoticed.
-- Paulo Marques - www.grupopie.com
All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke (1729 - 1797) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

