зеркало из https://github.com/mozilla/pjs.git
Cleanup CERT_GetGeneralNameByType so that it detects when it has
encountered a general name of a type that it doesn't recognize, and so that it properly casts the return value to be of the right type.
This commit is contained in:
Родитель
9eb859c9cf
Коммит
c40a094aad
|
@ -917,7 +917,6 @@ loser:
|
||||||
return SECFailure;
|
return SECFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
CERT_GetGeneralNameByType (CERTGeneralName *genNames,
|
CERT_GetGeneralNameByType (CERTGeneralName *genNames,
|
||||||
CERTGeneralNameType type, PRBool derFormat)
|
CERTGeneralNameType type, PRBool derFormat)
|
||||||
|
@ -925,38 +924,35 @@ CERT_GetGeneralNameByType (CERTGeneralName *genNames,
|
||||||
CERTGeneralName *current;
|
CERTGeneralName *current;
|
||||||
|
|
||||||
if (!genNames)
|
if (!genNames)
|
||||||
return (NULL);
|
return NULL;
|
||||||
current = genNames;
|
current = genNames;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (current->type == type) {
|
if (current->type == type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case certDNSName:
|
case certDNSName:
|
||||||
case certEDIPartyName:
|
case certEDIPartyName:
|
||||||
case certIPAddress:
|
case certIPAddress:
|
||||||
case certRegisterID:
|
case certRegisterID:
|
||||||
case certRFC822Name:
|
case certRFC822Name:
|
||||||
case certX400Address:
|
case certX400Address:
|
||||||
case certURI: {
|
case certURI:
|
||||||
return &(current->name.other);
|
return (void *)¤t->name.other; /* SECItem * */
|
||||||
}
|
|
||||||
case certOtherName: {
|
case certOtherName:
|
||||||
return &(current->name.OthName);
|
return (void *)¤t->name.OthName; /* OthName * */
|
||||||
break;
|
|
||||||
}
|
case certDirectoryName:
|
||||||
case certDirectoryName: {
|
return derFormat
|
||||||
if (derFormat) {
|
? (void *)¤t->derDirectoryName /* SECItem * */
|
||||||
return &(current->derDirectoryName);
|
: (void *)¤t->name.directoryName; /* CERTName * */
|
||||||
} else{
|
|
||||||
return &(current->name.directoryName);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
PORT_Assert(0);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
current = cert_get_next_general_name(current);
|
current = cert_get_next_general_name(current);
|
||||||
} while (current != genNames);
|
} while (current != genNames);
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Загрузка…
Ссылка в новой задаче