Subject: Re: lib/35401
To: None <netbsd-bugs@netbsd.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 01/11/2007 09:56:55
Christos Zoulas wrote:
> On Jan 10, 11:45pm, andreas.wiese@instandbesetzt.net (Andreas Wiese) wrote:
> -- Subject: lib/35401: blubb
> 
> How about this:
> 
> christos
> 
> Index: vfprintf.c
> ===================================================================
> RCS file: /cvsroot/src/lib/libc/stdio/vfprintf.c,v
> retrieving revision 1.54
> diff -u -u -r1.54 vfprintf.c
> --- vfprintf.c	30 Oct 2006 05:10:40 -0000	1.54
> +++ vfprintf.c	11 Jan 2007 02:56:58 -0000
> @@ -353,6 +353,8 @@
>  		if ((m = fmt - cp) != 0) {
>  			PRINT(cp, m);
>  			ret += m;
> +			if (ret < 0)
> +				goto ovfl;
>  		}

For what it's worth, this has undefined behaviour even though it probably just
works with the current GCC.

-- 
Christian