X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fx509%2Fby_dir.c;h=b83a473017341f2dc07576044195aeb9e1779ada;hp=b519dc45da7995fb7717125002852c727e5b49da;hb=53a73768a7f17dba012615ea79960d724b310856;hpb=0904e79a6e6109240d5a552f2699408b26cf63ee diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index b519dc45da..b83a473017 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -7,15 +7,13 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" +#include "internal/cryptlib.h" #include #include #include +#include -#include "internal/cryptlib.h" - -#ifndef NO_SYS_TYPES_H -# include -#endif #ifndef OPENSSL_NO_POSIX_IO # include #endif @@ -152,7 +150,9 @@ static void free_dir(X509_LOOKUP *lu) static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) { - const char *s, *p; + int j; + size_t len; + const char *s, *ss, *p; if (dir == NULL || !*dir) { X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); @@ -164,17 +164,14 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) do { if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { BY_DIR_ENTRY *ent; - int j; - size_t len; - const char *ss = s; + ss = s; s = p + 1; len = p - ss; if (len == 0) continue; for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); - if (strlen(ent->dir) == len && - strncmp(ent->dir, ss, len) == 0) + if (strlen(ent->dir) == len && strncmp(ent->dir, ss, len) == 0) break; } if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) @@ -295,8 +292,8 @@ static int get_cert_by_subject(X509_LOOKUP *xl, X509_LOOKUP_TYPE type, BIO_snprintf(b->data, b->max, "%s%08lx.%s%d", ent->dir, h, postfix, k); } else { - sprintf(b->data, - "%s%c%08lx.%s%d", ent->dir, c, h, postfix, k); + BIO_snprintf(b->data, b->max, + "%s%c%08lx.%s%d", ent->dir, c, h, postfix, k); } #ifndef OPENSSL_NO_POSIX_IO # ifdef _WIN32