Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace sprintf with snprintf #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test_h25.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ bool test_h25(bool fast_flag, bool quiet_flag) {
long i;
for (i=0; i<100000; i++) {
char message[30];
sprintf( message, "Message %ld", i );
snprintf( message, sizeof message, "Message %ld", i );
unsigned message_len = strlen(message);
bool success = hss_generate_signature( w, NULL, privkey,
message, message_len,
Expand Down
2 changes: 1 addition & 1 deletion test_keyload.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ if (len_signature == 0) return false;

/* Generate a bunch of signatures of the same text */
char text[ 100 ];
unsigned len_text = sprintf( text, "Message #%d", i );
unsigned len_text = snprintf( text, sizeof text, "Message #%d", i );

if (!hss_generate_signature( w[0], NULL, private_key,
text, len_text,
Expand Down
2 changes: 1 addition & 1 deletion test_reserve.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ bool test_reserve(bool fast_flag, bool quiet_flag) {
}
}
char message[ 100 ];
size_t len_message = sprintf( message, "Message #%d", i );
size_t len_message = snprintf( message, sizeof message, "Message #%d", i );
got_update = false;
struct hss_extra_info info = { 0 };
unsigned char signature[ 16000 ];
Expand Down