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

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