From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2549 invoked by alias); 26 Jun 2009 12:10:54 -0000 Received: (qmail 2540 invoked by uid 22791); 26 Jun 2009 12:10:53 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-vbr14.xs4all.nl (HELO smtp-vbr14.xs4all.nl) (194.109.24.34) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Jun 2009 12:10:47 +0000 Received: from [192.168.1.66] (cust.7.108.adsl.cistron.nl [82.95.157.21]) by smtp-vbr14.xs4all.nl (8.13.8/8.13.8) with ESMTP id n5QCAbkv096754; Fri, 26 Jun 2009 14:10:42 +0200 (CEST) (envelope-from rutger@cs.vu.nl) Message-ID: <4A44BC4E.5030508@cs.vu.nl> Date: Fri, 26 Jun 2009 12:10:00 -0000 From: Rutger Hofman User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: Chris Holgate CC: ecos-devel@ecos.sourceware.org Subject: Re: Should we add compiler warnings to diag_sprintf & diag_vsprintf ? References: <4A44B683.5060602@zynaptic.com> In-Reply-To: <4A44B683.5060602@zynaptic.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2009-06/txt/msg00038.txt.bz2 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. Rutger