public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
From: Rutger Hofman <rutger@cs.vu.nl>
To: Chris Holgate <chris@zynaptic.com>
Cc: ecos-devel@ecos.sourceware.org
Subject: Re: Should we add compiler warnings to diag_sprintf & diag_vsprintf   ?
Date: Fri, 26 Jun 2009 12:18:00 -0000	[thread overview]
Message-ID: <4A44BE0B.3050108@cs.vu.nl> (raw)
In-Reply-To: <4A44BC4E.5030508@cs.vu.nl>

Rutger Hofman wrote:
> Chris Holgate wrote:
>> I've just had to add support for diag_vsnprintf to diag.h as part of
>> writing some logging code.  We all know that sprintf, vsprintf and their
>>  evil unchecked spawn are the source of lots of buffer overflow bugs -
>> so while I'm prepping a patch for this change is it worth adding
>> compiler warning attributes to diag_sprintf and diag_vsprintf to help
>> 'discourage' their use?
> 
> That would collide with -Werror -- an option I happen to like a lot. 
> Besides, my guess is that the vsnprintf functions will be called through 
> some printf-style variadic function, and the compiler can verify 
> arguments there.

Ach, I misunderstood. You want to discourage diag_sprintf and 
diag_vsprintf in favour of diag_vsnprintf. I fully agree here.

Rutger

      reply	other threads:[~2009-06-26 12:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-26 11:53 Chris Holgate
2009-06-26 12:10 ` Rutger Hofman
2009-06-26 12:18   ` Rutger Hofman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A44BE0B.3050108@cs.vu.nl \
    --to=rutger@cs.vu.nl \
    --cc=chris@zynaptic.com \
    --cc=ecos-devel@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).