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

Vasil Dimov vd at datamax.bg
Tue Jul 12 15:03:24 CEST 2005


On Tue, Jul 12, 2005 at 11:56:33AM +0200, Miloslav Trmac wrote:
> Hello,
> stack_info () in stunnel-4.11 uses "%d" to print values of type size_t.
> The attached patch fixes this.
> 	Mirek

Content-Description: stunnel-4.11-printf.patch
> --- stunnel-4.11/src/sthreads.c.printf	2005-07-12 11:43:42.000000000 +0200
> +++ stunnel-4.11/src/sthreads.c	2005-07-12 11:46:33.000000000 +0200
> @@ -337,10 +337,10 @@
>          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. If it is not available, I suggest the
cast to be to "unsigned long long", not "int".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 155 bytes
Desc: not available
URL: <http://www.stunnel.org/pipermail/stunnel-users/attachments/20050712/224137b9/attachment.sig>


More information about the stunnel-users mailing list