WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] Use string bounded functions

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH] Use string bounded functions
From: "Christoph Egger" <Christoph.Egger@xxxxxxx>
Date: Mon, 29 Jan 2007 12:10:58 +0100
Cc: Keir Fraser <keir@xxxxxxxxxxxxx>
Delivery-date: Mon, 29 Jan 2007 03:10:52 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C1E3827A.85C0%keir@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: AMD / OSRC
References: <C1E3827A.85C0%keir@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.4
On Monday 29 January 2007 11:52, Keir Fraser wrote:
> On 29/1/07 10:10, "Christoph Egger" <Christoph.Egger@xxxxxxx> wrote:
> > The attached patch replaces sprintf with snprintf and strncpy with
> > strlcpy.
> >
> > There are various cases where no NULL-terminated strings are guaranteed
> > and eventual possible overflows. This patch fixes them.
> >
> > BTW: Since Xen kernel has its own string functions, can't we just remove
> > sprintf() and strncpy()? IMO, Xen should not inherit the historical C
> > relicts.
>
> This makes plenty of sense. Strncpy() in particular is dangerous and
> strlcpy() is always preferable. So I'd be happy to see strncat/strncpy die.

sprintf() is also dangerous. snprintf() is better. sprintf() should also die.

> There are a few uses remaining (particularly in arch/ia64) that you'll have
> to fix first.

Yeah. But due to lack of hw, I can't even build test for ia64 and ppc.
So when I send the patches, intel and ibm have to verify first that they don't
break anything.

> And please add 'signed-off-by' attribution when you post patches!

Will do.

Christoph



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel