summaryrefslogtreecommitdiffstats
path: root/crypto/store
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2017-08-21 07:19:17 +1000
committerPauli <paul.dale@oracle.com>2017-08-22 09:45:25 +1000
commita1df06b36347a31c17d09e6ca3e1464bdf7eb4d5 (patch)
treebeb260df46896a5c8668dd7f64c5dcefe677b1e6 /crypto/store
parent00dfbaad88a69ed8294d6039bf5f7d722f72bf39 (diff)
This has been added to avoid the situation where some host ctype.h functions
return true for characters > 127. I.e. they are allowing extended ASCII characters through which then cause problems. E.g. marking superscript '2' as a number then causes the common (ch - '0') conversion to number to fail miserably. Likewise letters with diacritical marks can also cause problems. If a non-ASCII character set is being used (currently only EBCDIC), it is adjusted for. The implementation uses a single table with a bit for each of the defined classes. These functions accept an int argument and fail for values out of range or for characters outside of the ASCII set. They will work for both signed and unsigned character inputs. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4102)
Diffstat (limited to 'crypto/store')
-rw-r--r--crypto/store/loader_file.c3
-rw-r--r--crypto/store/store_register.c8
2 files changed, 6 insertions, 5 deletions
diff --git a/crypto/store/loader_file.c b/crypto/store/loader_file.c
index 99c9350cf8..f6cb928ae3 100644
--- a/crypto/store/loader_file.c
+++ b/crypto/store/loader_file.c
@@ -23,6 +23,7 @@
#include <openssl/ui.h>
#include <openssl/x509.h> /* For the PKCS8 stuff o.O */
#include "internal/asn1_int.h"
+#include "internal/ctype.h"
#include "internal/o_dir.h"
#include "internal/cryptlib.h"
#include "internal/store_int.h"
@@ -783,7 +784,7 @@ static OSSL_STORE_LOADER_CTX *file_open(const OSSL_STORE_LOADER *loader,
#ifdef _WIN32
/* Windows file: URIs with a drive letter start with a / */
if (p[0] == '/' && p[2] == ':' && p[3] == '/') {
- char c = tolower(p[1]);
+ char c = ossl_tolower(p[1]);
if (c >= 'a' && c <= 'z') {
p++;
diff --git a/crypto/store/store_register.c b/crypto/store/store_register.c
index 6af7144f5c..85c38b84dd 100644
--- a/crypto/store/store_register.c
+++ b/crypto/store/store_register.c
@@ -8,7 +8,7 @@
*/
#include <string.h>
-#include <ctype.h>
+#include "internal/ctype.h"
#include <assert.h>
#include <openssl/err.h>
@@ -140,10 +140,10 @@ int ossl_store_register_loader_int(OSSL_STORE_LOADER *loader)
*
* scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
*/
- if (isalpha(*scheme))
+ if (ossl_isalpha(*scheme))
while (*scheme != '\0'
- && (isalpha(*scheme)
- || isdigit(*scheme)
+ && (ossl_isalpha(*scheme)
+ || ossl_isdigit(*scheme)
|| strchr("+-.", *scheme) != NULL))
scheme++;
if (*scheme != '\0') {