Bug 1322071 - don't pass multi-byte ints to isprint, r=ttaubert
authorFranziskus Kiefer <franziskuskiefer@gmail.com>
Mon, 10 Jul 2017 15:07:14 +0200
changeset 13501 68ed01d8d567e66ad27a526d931a7bd329b5df80
parent 13500 2a84e61b588e7ab2b355705e2d71505d8904d043
child 13502 6254e8431392863fd0aa7e70c311add48af05775
push id2302
push userfranziskuskiefer@gmail.com
push dateWed, 02 Aug 2017 10:56:07 +0000
reviewersttaubert
bugs1322071
Bug 1322071 - don't pass multi-byte ints to isprint, r=ttaubert Differential Revision: https://nss-review.dev.mozaws.net/D365
cmd/lib/secutil.c
--- a/cmd/lib/secutil.c
+++ b/cmd/lib/secutil.c
@@ -986,17 +986,17 @@ secu_PrintUniversalString(FILE *out, con
     len = (int)(my.len / 4);
     tmp.data = (unsigned char *)PORT_Alloc(len);
     if (!tmp.data)
         goto loser;
     tmp.len = len;
     for (s = my.data, d = tmp.data; len > 0; len--) {
         PRUint32 bmpChar = (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3];
         s += 4;
-        if (!isprint(bmpChar))
+        if (!isprint(bmpChar & 0xFF))
             goto loser;
         *d++ = (unsigned char)bmpChar;
     }
     secu_PrintRawString(out, &tmp, m, level);
     PORT_Free(tmp.data);
     return;
 
 loser: