projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Oops, s can be NULL
[oweals/openssl.git]
/
crypto
/
x509
/
by_dir.c
diff --git
a/crypto/x509/by_dir.c
b/crypto/x509/by_dir.c
index 11e9c1ec0a953ed92bb90df0b71d64ae119a43d8..170cd89608f9646ee9a2b291b512cedeebff27b3 100644
(file)
--- a/
crypto/x509/by_dir.c
+++ b/
crypto/x509/by_dir.c
@@
-72,8
+72,6
@@
#include <openssl/lhash.h>
#include <openssl/x509.h>
#include <openssl/lhash.h>
#include <openssl/x509.h>
-DECLARE_STACK_OF(BY_DIR_HASH)
-DECLARE_STACK_OF(BY_DIR_ENTRY)
typedef struct lookup_dir_hashes_st
{
typedef struct lookup_dir_hashes_st
{
@@
-94,6
+92,8
@@
typedef struct lookup_dir_st
STACK_OF(BY_DIR_ENTRY) *dirs;
} BY_DIR;
STACK_OF(BY_DIR_ENTRY) *dirs;
} BY_DIR;
+DECLARE_STACK_OF(BY_DIR_HASH)
+DECLARE_STACK_OF(BY_DIR_ENTRY)
static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,
char **ret);
static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,
char **ret);
@@
-218,7
+218,7
@@
static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
s=dir;
p=s;
s=dir;
p=s;
- for (;;)
+ for (;;
p++
)
{
if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0'))
{
{
if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0'))
{
@@
-230,10
+230,12
@@
static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
for (j=0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++)
{
ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
for (j=0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++)
{
ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
- if (strncmp(ent->dir,ss,(unsigned int)len) == 0)
- continue;
+ if (strlen(ent->dir) == (size_t)len &&
+ strncmp(ent->dir,ss,(unsigned int)len) == 0)
+ break;
}
}
-
+ if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
+ continue;
if (ctx->dirs == NULL)
{
ctx->dirs = sk_BY_DIR_ENTRY_new_null();
if (ctx->dirs == NULL)
{
ctx->dirs = sk_BY_DIR_ENTRY_new_null();
@@
-264,7
+266,6
@@
static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
}
if (*p == '\0')
break;
}
if (*p == '\0')
break;
- p++;
}
return 1;
}
}
return 1;
}
@@
-352,12
+353,15
@@
static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE);
}
else
CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE);
}
else
+ {
k = 0;
k = 0;
+ hent = NULL;
+ }
for (;;)
{
char c = '/';
#ifdef OPENSSL_SYS_VMS
for (;;)
{
char c = '/';
#ifdef OPENSSL_SYS_VMS
- c = ent->dir[strlen(
ctx->dirs[i]
)-1];
+ c = ent->dir[strlen(
ent->dir
)-1];
if (c != ':' && c != '>' && c != ']')
{
/* If no separator is present, we assume the
if (c != ':' && c != '>' && c != ']')
{
/* If no separator is present, we assume the
@@
-388,6
+392,9
@@
static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
postfix,k);
}
#ifndef OPENSSL_NO_POSIX_IO
postfix,k);
}
#ifndef OPENSSL_NO_POSIX_IO
+#ifdef _WIN32
+#define stat _stat
+#endif
{
struct stat st;
if (stat(b->data,&st) < 0)
{
struct stat st;
if (stat(b->data,&st) < 0)