[prev in list] [next in list] [prev in thread] [next in thread] 

List:       stunnel-users
Subject:    Re: [stunnel-users] [PATCH] Fix int/size_t mismatch in stack_info ()
From:       Miloslav Trmac <mitr () redhat ! com>
Date:       2005-07-12 13:10:19
Message-ID: 20050712131019.GA2704 () amilo ! ms ! mff ! cuni ! cz
[Download RAW message or body]

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
_______________________________________________
stunnel-users mailing list
stunnel-users@mirt.net
http://stunnel.mirt.net/mailman/listinfo/stunnel-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic