Bläddra i källkod

libdpkg: Cast c_isbits() c argument to unsigned char when indexing the array

We need c to wrap around as an unsigned char when it is -1 (i.e. EOF).
Guillem Jover 11 år sedan
förälder
incheckning
2739012645
2 ändrade filer med 5 tillägg och 1 borttagningar
  1. 4 0
      debian/changelog
  2. 1 1
      lib/dpkg/c-ctype.c

+ 4 - 0
debian/changelog

@@ -1,5 +1,9 @@
 dpkg (1.18.1) UNRELEASED; urgency=low
 
+  [ Guillem Jover ]
+  * Cast c_isbits() c argument to an unsigned char when indexing the array.
+    This fixes build failures on armel, armhf, ppc64el and s390x.
+
   [ Updated programs translations ]
   * German (Sven Joachim).
 

+ 1 - 1
lib/dpkg/c-ctype.c

@@ -182,5 +182,5 @@ static unsigned short int c_ctype[256] = {
 bool
 c_isbits(int c, enum c_ctype_bit bits)
 {
-	return ((c_ctype[c] & bits) != 0);
+	return ((c_ctype[(unsigned char)c] & bits) != 0);
 }