apps/speed.c: add -aead flag.
[openssl.git] / crypto / ctype.c
index 89ed5bf486b95b5725551076b7b845b0184bc080..813be25a074121df57e357d44d2c48719a02504d 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <string.h>
+#include <stdio.h>
 #include "internal/ctype.h"
 #include "openssl/ebcdic.h"
 
@@ -225,7 +226,7 @@ static const unsigned short ctype_char_map[128] = {
 #ifdef CHARSET_EBCDIC
 int ossl_toascii(int c)
 {
-    if (c < -128 || c > 256)
+    if (c < -128 || c > 256 || c == EOF)
         return c;
     /*
      * Adjust negatively signed characters.
@@ -240,7 +241,7 @@ int ossl_toascii(int c)
 
 int ossl_fromascii(int c)
 {
-    if (c < -128 || c > 256)
+    if (c < -128 || c > 256 || c == EOF)
         return c;
     if (c < 0)
         c += 256;
@@ -251,9 +252,9 @@ int ossl_fromascii(int c)
 int ossl_ctype_check(int c, unsigned int mask)
 {
     const int max = sizeof(ctype_char_map) / sizeof(*ctype_char_map);
+    const int a = ossl_toascii(c);
 
-    c = ossl_toascii(c);
-    return c >= 0 && c < max && (ctype_char_map[c] & mask) != 0;
+    return a >= 0 && a < max && (ctype_char_map[a] & mask) != 0;
 }
 
 #if defined(CHARSET_EBCDIC) && !defined(CHARSET_EBCDIC_TEST)