Skip to content

Commit

Permalink
Ensure correct type for uri prints
Browse files Browse the repository at this point in the history
  • Loading branch information
tilkinsc committed Dec 5, 2023
1 parent 7107447 commit 8ad7e74
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions otpuri.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <stdio.h>
#include <string.h>
#include <inttypes.h>


/*
Expand Down Expand Up @@ -131,7 +132,7 @@ COTPRESULT otpuri_build_uri(OTPData* data, const char* issuer, const char* name,
strcat(output, "&digits=");
char cdigits[21];
memset(cdigits, 0, 21);
snprintf(cdigits, 21, "%Iu", data->digits);
snprintf(cdigits, 21, "%" PRIu32, data->digits);
strcat(output, cdigits);

switch(data->method)
Expand All @@ -140,14 +141,14 @@ COTPRESULT otpuri_build_uri(OTPData* data, const char* issuer, const char* name,
strcat(output, "&period=");
char cperiod[21];
memset(cperiod, 0, 21);
snprintf(cperiod, 21, "%Iu", data->interval);
snprintf(cperiod, 21, "%" PRIu32, data->interval);
strcat(output, cperiod);
break;
case HOTP:
strcat(output, "&counter=");
char ccounter[21];
memset(ccounter, 0, 21);
snprintf(ccounter, 21, "%zu", data->count);
snprintf(ccounter, 21, "%" PRIu64, data->count);
strcat(output, ccounter);
break;
default:
Expand Down

0 comments on commit 8ad7e74

Please sign in to comment.