libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remove deps on *printf(3) in libltdl


From: Bob Friesenhahn
Subject: Re: Remove deps on *printf(3) in libltdl
Date: Tue, 4 Jan 2005 21:07:13 -0600 (CST)

On Tue, 4 Jan 2005, Jacob Meuser wrote:

On Tue, Jan 04, 2005 at 05:07:16PM +0100, Paolo Bonzini wrote:
Feel free to make your own applications spontaneously abort as much as
you like, but please don't impose spontaneous aborts due to user input
on my programs.  Many programs are designed to report an error and
continue executing.

An excessively long string does not necessary indicate an insane program.

This is not how GNU programs should behave.  The GNU coding standards
explicitly say

 Avoid arbitrary limits on the length or number of _any_ data structure,
 including file names, lines, files, and symbols, by allocating all data
 structures dynamically.  In most Unix utilities, "long lines are
 silently truncated".  This is not acceptable in a GNU utility.

So everything that is subject to user input must be malloced in libltdl,
and strlcpy will only be used to *protect against programmer mistakes*.
 Which means, abort if they are found, instead of "silently truncated".

it's not "silently truncated".  strlcpy returns the size of the
string it _tried_ to create.  if that is >= the size it was limited to,
it got truncated.

You forgot to point out that libltdl is not a GNU utility so the quoted coding standard does not apply. :-)

It is pointless to carry more precison than can actually be used. There is nothing in libltdl which needs to contain strings longer than a filesystem path. Doing so is counter-productive.

I can't recall the last time that GCC called abort() due to syntax errors in my program rather than attempting to provide a diagnostic error message.

Bob
======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]