Fix overflow in example_sig_stfl (credit @wangweij) (#1887)

Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
This commit is contained in:
Spencer Wilson 2024-08-12 15:54:11 -04:00 committed by GitHub
parent 4f8c9e2c67
commit fc2264d150
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,7 +67,7 @@ static OQS_STATUS stfl_example(char *method_name) {
* Allocate storage for public key, secret key filename, message and signature
*/
public_key = malloc(sig->length_public_key);
sk_fname = malloc(strlen(method_name) + strlen(".sk"));
sk_fname = malloc(strlen(method_name) + strlen(".sk") + 1);
message = malloc(message_len);
signature = malloc(sig->length_signature);
if ((public_key == NULL) || (message == NULL) || (signature == NULL) || (sk_fname == NULL)) {