Blame SOURCES/0011-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch

4e0e09
From 4468e686c271cd208d741de4b304200bf28832f9 Mon Sep 17 00:00:00 2001
4e0e09
From: Javier Martinez Canillas <javierm@redhat.com>
4e0e09
Date: Tue, 5 Mar 2019 17:23:32 +0100
4e0e09
Subject: [PATCH 11/63] ucs2.h: fix logic that checks for UCS-2 string
4e0e09
 termination
4e0e09
4e0e09
Currently the loop to count the lenght of the UCS-2 string ends if either
4e0e09
of the two bytes are 0, but 0 is a valid value for UCS-2 character codes.
4e0e09
4e0e09
So only break the loop when 0 is the value for both UCS-2 char bytes.
4e0e09
4e0e09
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
4e0e09
---
4e0e09
 src/ucs2.h | 2 +-
4e0e09
 1 file changed, 1 insertion(+), 1 deletion(-)
4e0e09
4e0e09
diff --git a/src/ucs2.h b/src/ucs2.h
4e0e09
index e0390c34985..fd8b056ad25 100644
4e0e09
--- a/src/ucs2.h
4e0e09
+++ b/src/ucs2.h
4e0e09
@@ -29,7 +29,7 @@ ucs2len(const void *vs, ssize_t limit)
4e0e09
 	const uint8_t *s8 = vs;
4e0e09
 
4e0e09
 	for (i = 0;
4e0e09
-	     i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
4e0e09
+	     i < (limit >= 0 ? limit : i+1) && !(s8[0] == 0 && s8[1] == 0);
4e0e09
 	     i++, s8 += 2)
4e0e09
 		;
4e0e09
 	return i;
4e0e09
-- 
4e0e09
2.26.2
4e0e09