提交 fa9ac569 编写于 作者: N Nils Larsch

avoid duplicate entries in add_cert_dir()

PR: 1407
Submitted by: Tomas Mraz <tmraz@redhat.com>
上级 10a10fb8
...@@ -218,7 +218,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) ...@@ -218,7 +218,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
s=dir; s=dir;
p=s; 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) ...@@ -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++) for (j=0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++)
{ {
ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
if (strncmp(ent->dir,ss,(unsigned int)len) == 0) if (strlen(ent->dir) == len &&
continue; strncmp(ent->dir,ss,(unsigned int)len) == 0)
break;
} }
if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
continue;
if (ctx->dirs == NULL) if (ctx->dirs == NULL)
{ {
ctx->dirs = sk_BY_DIR_ENTRY_new_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) ...@@ -264,7 +266,6 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
} }
if (*p == '\0') if (*p == '\0')
break; break;
p++;
} }
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册