Re: CD-RW

Alan Cox (alan@lxorguk.ukuu.org.uk)
Sun, 30 May 1999 00:31:39 +0100 (BST)


> > else
> > strcat(obuf, "(can not get system error message)");
> > mlwrite(obuf);
>
> The while "if (errno < sys_nerr)" can be safely replaced by:
>
> strcat(obuf, strerror(errno));
>
> as the manual page assures that a reasonable message is given if the errno
> is unknown.

Classic NLS error. Never never do this. The length of strerror is undefined
and dependant entirely on national tables. Its also handy in setuid and
other security sensitive binaries to a cracker as they can load custom
tables for any length complete with exploit.

Please use snprintf or strncat and similar

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/