Current-Users archive

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

Re: Possible unsafe use of strncat in sbin/sysctl/sysctl.c

On Wed, Aug 24, 2011 at 09:59:34AM +0200, Hauke Fath wrote:
 > >I can always create bugs, and spilling (void) all over only helps maybe
 > >a tiniy fraction of them.
 > Agreed. (void)foo() seems the moral equivalent of suse's "alias rm '/bin/rm
 > -i'" to me.

For functions like strcpy, yes. This is why I said the problem is that
lint is stupid; it demands the (void) in lots of useless places. But
consider this code:

   main(int argc, char *argv[])
           initialize_from_args(argc, argv);
           return 0;

It's a lot, lot clearer that I meant it if I write (void)malloc(1).

(and yes, I really did that once, it was to make sure malloc
initialized itself before entering code that was timed.)

David A. Holland

Home | Main Index | Thread Index | Old Index