mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:35:06 -05:00
nts: don't allow malformed encrypted extension fields
Require data decrypted from the NTS authenticator field to contain correctly formatted extension fields (known or unknown).
This commit is contained in:
@@ -352,8 +352,10 @@ extract_cookies(NNC_Instance inst, unsigned char *plaintext, int length)
|
||||
|
||||
for (parsed = 0; parsed < length; parsed += ef_length) {
|
||||
if (!NEF_ParseSingleField(plaintext, length, parsed,
|
||||
&ef_length, &ef_type, &ef_body, &ef_body_length))
|
||||
break;
|
||||
&ef_length, &ef_type, &ef_body, &ef_body_length)) {
|
||||
DEBUG_LOG("Could not parse encrypted EF");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ef_type != NTP_EF_NTS_COOKIE)
|
||||
continue;
|
||||
|
||||
@@ -176,8 +176,10 @@ NNS_CheckRequestAuth(NTP_Packet *packet, NTP_PacketInfo *info, uint32_t *kod)
|
||||
|
||||
for (parsed = 0; parsed < plaintext_length; parsed += ef_length) {
|
||||
if (!NEF_ParseSingleField(plaintext, plaintext_length, parsed,
|
||||
&ef_length, &ef_type, &ef_body, &ef_body_length))
|
||||
break;
|
||||
&ef_length, &ef_type, &ef_body, &ef_body_length)) {
|
||||
DEBUG_LOG("Could not parse encrypted EF");
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (ef_type) {
|
||||
case NTP_EF_NTS_COOKIE_PLACEHOLDER:
|
||||
|
||||
Reference in New Issue
Block a user