Re: Variable-sized lines of text in linked list



On Fri, 29 Feb 2008 07:29:10 -0600, Richard Heathfield wrote
(in article <9fydnSXSEM8rmlXanZ2dneKdnZzinZ2d@xxxxxx>):

Richard Tobin said:

In article <eIKdnV4AV7CsnFXanZ2dnUVZ8rCdnZ2d@xxxxxx>,
Richard Heathfield <rjh@xxxxxxxxxxxxxxx> wrote:

A third problem is that of Denial of Memory attacks, where malicious
users seek (perhaps over a remote connection) to bring the program down
by asking it to deal with ludicrously long lines.

Whether the ability of a function to read a line limited only by the
amount of available memory is a disadvantage or an advantage depends
on the context. Not every program has to be robust again malicious
attacks.

Agreed - which is why ggets should not be dismissed out of hand.
Furthermore, ggets has the advantage of a very simple user interface. This
is not an advantage to be lightly dismissed. Nevertheless, the problems I
mentioned are also significant, and I think Chuck would be wiser to point
them out when he is recommending his function for other people, who might
not have as much experience as he does in deciding when ggets is, and is
not, appropriate in a particular situation.

Since we're on the topic of these, can you comment on why your fgetline
and fgetword functions seem have an inconsistent API?

For example:

int fgetline(char **line, size_t *size, size_t maxrecsize, FILE *fp,
unsigned int flags);

int fgetword(char **word, size_t *size, const char *delimiters,
size_t maxrecsize, FILE *fp, unsigned int flags);


It seems to me it would be a lot more consistent if the common
arguments to both functions appeared first and in the same order.

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw





.