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

Alan Coopersmith alan.coopersmith at oracle.com
Sun Mar 25 02:48:49 UTC 2018


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.

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



More information about the xorg-devel mailing list