-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Secure Session serialization format (#658)
secure_session_save() saves short serialized Secure Session state. That is, it writes "is_client" as 4-byte value while its size in SESSION_CTX_SERIZALIZED_SIZE is computed as sizeof(bool) which is 1 byte on most platforms. This causes 3 least significant bytes of "in_seq" being missing from the serialized data. Correct size of Secure Session state is 60 bytes, we report only 57. This issue is not detected by unit tests of JavaThemis -- the only high-level wrapper supporting this interface -- which works only because the allocated memory for the output array is slightly bigger than requested 57 bytes, extra 3 bytes written past-the-end remain there in RAM and the unit test generally works, if the data stays where it is. However, sometimes garbage collection occurs at the right moment and the issue manifests itself as a failing Secure Session test. Now the output size is reported correctly and all Secure Session data is written within the allocated bounds.
- Loading branch information
Showing
2 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters