On Sat, Nov 28, 2020 at 11:20:30PM +0100, Theo Buehler wrote:
> /usr/src/usr.sbin/ldapd/util.c:46:21: warning: comparison of integers of 
> different signs:
>       'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
>         if (ret < 0 || ret >= size)
>                        ~~~ ^  ~~~~
> 
> This has been around for a while. I forgot that I had this patch in my
> tree.

'size' was cast to int before r1.11 of util.c, I'm not sure why the cast was
removed.  smtpd also has a copy of this function that still has the cast.


> 
> Index: util.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ldapd/util.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 util.c
> --- util.c    24 Oct 2019 12:39:26 -0000      1.12
> +++ util.c    4 Aug 2020 07:14:33 -0000
> @@ -43,7 +43,7 @@ bsnprintf(char *str, size_t size, const 
>       va_start(ap, format);
>       ret = vsnprintf(str, size, format, ap);
>       va_end(ap);
> -     if (ret < 0 || ret >= size)
> +     if (ret < 0 || (size_t)ret >= size)
>               return 0;
>  
>       return 1;
> 

Reply via email to