mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:05:06 -05:00
nts: improve NTS-KE server/client code
Add more assertions and comments, refactor initialization of the helper, and make other changes to make the code more robust.
This commit is contained in:
@@ -154,6 +154,7 @@ get_record(struct Message *message, int *critical, int *type, int *body_length,
|
||||
|
||||
blen = ntohs(header.body_length);
|
||||
rlen = sizeof (header) + blen;
|
||||
assert(blen >= 0 && rlen > 0);
|
||||
|
||||
if (message->length < message->parsed + rlen)
|
||||
return 0;
|
||||
@@ -802,6 +803,9 @@ NKSN_GetRecord(NKSN_Instance inst, int *critical, int *type, int *body_length,
|
||||
|
||||
assert(inst->message.complete);
|
||||
|
||||
if (body_length)
|
||||
*body_length = 0;
|
||||
|
||||
if (!get_record(&inst->message, critical, &type2, body_length, body, buffer_length))
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user