[stunnel-users] [PATCH] Fix int/size_t mismatch in stack_info ()

Miloslav Trmac mitr at redhat.com
Tue Jul 12 15:10:19 CEST 2005


On Tue, Jul 12, 2005 at 04:03:24PM +0300, Vasil Dimov wrote:
> >          s_log(LOG_NOTICE,
> >              "stack_info: size=%d, current=%d (%d%%), maximum=%d (%d%%)",
> >              STACK_SIZE,
> > -            (VERIFY_AREA-num)*sizeof(u32),
> > -            (VERIFY_AREA-num)*sizeof(u32)*100/STACK_SIZE,
> > -            (VERIFY_AREA-min_num)*sizeof(u32),
> > -            (VERIFY_AREA-min_num)*sizeof(u32)*100/STACK_SIZE);
> > +            (int)((VERIFY_AREA-num)*sizeof(u32)),
> > +            (int)((VERIFY_AREA-num)*sizeof(u32)*100/STACK_SIZE),
> > +            (int)((VERIFY_AREA-min_num)*sizeof(u32)),
> > +            (int)((VERIFY_AREA-min_num)*sizeof(u32)*100/STACK_SIZE));

> 
> %zu should be used for size_t.
Yes, but not supported by some of the legacy UNIX systems. (I don't
know what requirements stunnel has on the underlying platform, so
I've decided to play it safe.)

> If it is not available, I suggest the
> cast to be to "unsigned long long", not "int".
"int" should be OK here: each of the values is <= STACK_SIZE or 100.
Because STACK_SIZE fits into an int, so do the other values.
	Mirek



More information about the stunnel-users mailing list