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

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