[PATCH libX11] Use size_t for buffer sizes in SetHints.c

Matthieu Herrb matthieu at herrb.eu
Sun Mar 25 10:07:35 UTC 2018


On Sat, Mar 24, 2018 at 07:48:49PM -0700, Alan Coopersmith wrote:
> These variables store values returned from strlen() as a size_t
> and are passed to Xmalloc, which expects a size_t, so lets stop
> converting back and forth to int along the way.

LGTM,
Reviewed-by: Matthieu Herrb <matthieu at herrb.eu>

> 
> Reported by: Konstantin SKliarov
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  src/SetHints.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/SetHints.c b/src/SetHints.c
> index 5f0a4d4c..626a2b3a 100644
> --- a/src/SetHints.c
> +++ b/src/SetHints.c
> @@ -211,7 +211,7 @@ XSetCommand (
>  	int argc)
>  {
>  	register int i;
> -	register int nbytes;
> +	size_t nbytes;
>  	register char *buf, *bp;
>  	for (i = 0, nbytes = 0; i < argc; i++) {
>  		nbytes += safestrlen(argv[i]) + 1;
> @@ -295,7 +295,7 @@ XSetClassHint(
>  {
>  	char *class_string;
>  	char *s;
> -	int len_nm, len_cl;
> +	size_t len_nm, len_cl;
>  
>  	len_nm = safestrlen(classhint->res_name);
>  	len_cl = safestrlen(classhint->res_class);
> -- 
> 2.15.0
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel

-- 
Matthieu Herrb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 793 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20180325/0a0a260f/attachment.sig>


More information about the xorg-devel mailing list