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

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