x509/by_dir.c: fix run-away pointer.

fix run-away pointer (and potential SEGV) when adding duplicates in
add_cert_dir.

PR: 3261
Reported by: Marian Done

(Imported from upstream's 83fe7b9c8321d5ffb6bfe67df85ed66ceb97102f)
This commit is contained in:
Adam Langley 2014-06-20 12:00:00 -07:00
parent f669c2d91a
commit c83b1ceae2

View File

@ -210,7 +210,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
s=dir; s=dir;
p=s; p=s;
for (;;p++) do
{ {
if ((*p == ':') || (*p == '\0')) if ((*p == ':') || (*p == '\0'))
{ {
@ -256,9 +256,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
return 0; return 0;
} }
} }
if (*p == '\0') } while (*p++ != '\0');
break;
}
return 1; return 1;
} }