Fail DN parsing if OID is unterminated
This is the case if the last OID is not followed by a = or if the string starts with a =.
This commit is contained in:
@@ -398,7 +398,7 @@ static status_t atodn(char *src, chunk_t *dn)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case SEARCH_OID:
|
case SEARCH_OID:
|
||||||
if (*src != ' ' && *src != '/' && *src != ',')
|
if (*src != ' ' && *src != '/' && *src != ',' && *src != '\0')
|
||||||
{
|
{
|
||||||
oid.ptr = src;
|
oid.ptr = src;
|
||||||
oid.len = 1;
|
oid.len = 1;
|
||||||
@@ -502,6 +502,11 @@ static status_t atodn(char *src, chunk_t *dn)
|
|||||||
}
|
}
|
||||||
} while (*src++ != '\0');
|
} while (*src++ != '\0');
|
||||||
|
|
||||||
|
if (state == READ_OID)
|
||||||
|
{ /* unterminated OID */
|
||||||
|
status = INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
/* build the distinguished name sequence */
|
/* build the distinguished name sequence */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -514,7 +519,6 @@ static status_t atodn(char *src, chunk_t *dn)
|
|||||||
free(rdns[i].ptr);
|
free(rdns[i].ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status != SUCCESS)
|
if (status != SUCCESS)
|
||||||
{
|
{
|
||||||
free(dn->ptr);
|
free(dn->ptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user