[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix 'no format arguments found' warning

From: Stefan Sperling <stsp_at_elego.de>
Date: Mon, 26 Oct 2009 12:06:41 +0100

On Mon, Oct 26, 2009 at 04:13:48PM +0530, Kannan wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Log:
> Resolve "format not a string literal and no format arguments found" warning.
>
> * subversion/libsvn_subr/io.c
> (do_io_file_wrapper_cleanup): Add the format specifier "%s", which
> fixes the warning.

We have those warnings all over the place, so if you want to fix
them all you're gonna be busy for a while.
But I'd love to see them fixed, because each of them is a possible
format-string vulnerability.

> Index: subversion/libsvn_subr/io.c
> ===================================================================
> --- subversion/libsvn_subr/io.c (revision 40199)
> +++ subversion/libsvn_subr/io.c (working copy)
> @@ -2790,7 +2790,7 @@
> return svn_error_wrap_apr(status, _(msg),
> svn_dirent_local_style(name, pool));

For example, the above call in your patch's context would need
a similar fix.

> else
> - return svn_error_wrap_apr(status, _(msg_no_name));
> + return svn_error_wrap_apr(status,"%s", _(msg_no_name));

We usually put a space after a comma.

Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2411344
Received on 2009-10-26 12:06:56 CET

This is an archived mail posted to the Subversion Dev mailing list.