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

Check return value of fscanf in LMS/XMSS KAT tests #1874

Merged
merged 2 commits into from
Jul 29, 2024
Merged
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
10 changes: 8 additions & 2 deletions tests/kat_sig_stfl.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ OQS_STATUS sig_stfl_kat(const char *method_name, const char *katfile) {

// Echo back remain
if (FindMarker(fp_rsp, "remain = ")) {
fscanf(fp_rsp, "%llu", &sigs_remain);
if (EOF == fscanf(fp_rsp, "%llu", &sigs_remain)) {
fprintf(stderr, "[kat_stfl_sig] %s ERROR: unable to read 'remain' from <%s>\n", method_name, katfile);
goto err;
};
fprintf(fh, "remain = %llu\n", sigs_remain);
} else {
fprintf(stderr, "[kat_stfl_sig] %s ERROR: OQS_SIG_STFL_sigs_remaining failed!\n", method_name);
Expand All @@ -320,7 +323,10 @@ OQS_STATUS sig_stfl_kat(const char *method_name, const char *katfile) {

// Echo back max
if (FindMarker(fp_rsp, "max = ")) {
fscanf(fp_rsp, "%llu", &sigs_maximum);
if (EOF == fscanf(fp_rsp, "%llu", &sigs_maximum)) {
fprintf(stderr, "[kat_stfl_sig] %s ERROR: unable to read 'max' from <%s>\n", method_name, katfile);
goto err;
};
fprintf(fh, "max = %llu\n", sigs_maximum);
} else {
fprintf(stderr, "[kat_stfl_sig] %s ERROR: OQS_SIG_STFL_sigs_total failed!\n", method_name);
Expand Down
Loading