-
Notifications
You must be signed in to change notification settings - Fork 325
Description
Hi all,
For the BOOLEAN EFIAPI ConvertAsn1TimeToEfiTime (IN ASN1_TIME *Asn1Time, OUT EFI_TIME *EfiTime) interface in Cryptlib/Pk/CryptTs.c, I have some questions.
EfiTime->Month = (Str[Index++] - '0') * 10;
EfiTime->Month += (Str[Index++] - '0');
if ((EfiTime->Month < 1) || (EfiTime->Month > 12)) {
return FALSE;
}
EfiTime->Day = (Str[Index++] - '0') * 10;
EfiTime->Day += (Str[Index++] - '0');
if ((EfiTime->Day < 1) || (EfiTime->Day > 31)) {
return FALSE;
}
Here, the validity of EfiTime->Day is not checked based on EfiTime->Month and EfiTime->Year. For instance, when EfiTime->Month is 2, EfiTime->Day in a common year should not exceed 28, and in a leap year, it should not exceed 29. When EfiTime->Month is 4, EfiTime->Day should not exceed 30.
Why is it only necessary to check whether EfiTime->Day is between 1 and 31 here? Could anyone help explain this? Thank you