mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 17:57:21 +09:00
box demos: do not attempt to print anything past the end of the plaintext
This commit is contained in:
+5
-3
@@ -128,9 +128,11 @@ box(void)
|
||||
putchar('\n');
|
||||
|
||||
print_verification(ret);
|
||||
if (ret == 0)
|
||||
printf("Plaintext: %s\n\n", message);
|
||||
|
||||
if (ret == 0) {
|
||||
printf("Plaintext: ");
|
||||
fwrite(message, 1U, message_len, stdout);
|
||||
putchar('\n');
|
||||
}
|
||||
sodium_memzero(bob_sk, sizeof bob_sk); /* wipe sensitive data */
|
||||
sodium_memzero(alice_sk, sizeof alice_sk);
|
||||
sodium_memzero(message, sizeof message);
|
||||
|
||||
@@ -128,9 +128,11 @@ box_detached(void)
|
||||
putchar('\n');
|
||||
|
||||
print_verification(ret);
|
||||
if (ret == 0)
|
||||
printf("Plaintext: %s\n\n", message);
|
||||
|
||||
if (ret == 0) {
|
||||
printf("Plaintext: ");
|
||||
fwrite(message, 1U, message_len, stdout);
|
||||
putchar('\n');
|
||||
}
|
||||
sodium_memzero(bob_sk, sizeof bob_sk); /* wipe sensitive data */
|
||||
sodium_memzero(alice_sk, sizeof alice_sk);
|
||||
sodium_memzero(message, sizeof message);
|
||||
|
||||
Reference in New Issue
Block a user