lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 24 Oct 2007 16:59:48 -0400
From:	Kyle Moffett <mrmacman_g4@....com>
To:	Matthew Wilcox <matthew@....cx>
Cc:	Linus Torvalds <torvalds@...l.org>, Andrew Morton <akpm@...l.org>,
	linux-kernel@...r.kernel.org,
	Matthew Wilcox <willy@...ux.intel.com>
Subject: Re: [PATCH 1/4] stringbuf: A string buffer implementation

On Oct 24, 2007, at 15:59:49, Matthew Wilcox wrote:
> +static void sb_vprintf(struct stringbuf *sb, gfp_t gfp, const char  
> *format, va_list args)
> +{

[...]

> +	s = sb->buf + sb->len;
> +	size = vsnprintf(s, sb->alloc - sb->len, format, args);

[...]

> +	/* Point to the end of the old string since we already updated - 
> >len */
> +	s += sb->len - size;
> +	vsprintf(s, format, args);

[...]

> +void sb_printf(struct stringbuf *sb, gfp_t gfp, const char  
> *format, ...)
> +{
> +	va_list args;
> +
> +	va_start(args, format);
> +	sb_vprintf(sb, gfp, format, args);
> +	va_end(args);
> +}

This seems unlikely to work reliably as the various "v*printf"  
functions modify the va_list argument they are passed.  It may happen  
to work on your particular architecture depending on how that  
argument data is passed and stored, but you probably actually want to  
make a copy of the varargs list for the first vsnprintf call.   
Example below:

> va_list argscopy;
> va_copy(argscopy, args);
>
> [...]
>
> size = vsnprintf(s, sb->alloc - sb->len, format, argscopy)
>
> [...]
>
> s += sb->len - size;
> vsprintf(s, format, args);
>
> [...]
>
> va_end(argscopy);

Cheers,
Kyle Moffett
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ