]> jfr.im git - irc/atheme/atheme.git/commitdiff
modules/crypto/argon2d: don't mix format strings for scanning & printing
authorAaron Jones <redacted>
Sun, 15 Oct 2017 11:01:45 +0000 (11:01 +0000)
committerAaron Jones <redacted>
Sun, 15 Oct 2017 11:01:45 +0000 (11:01 +0000)
The inttypes.h header provides format specifier macros for scanning, so
use those for parsing instead of the printing ones, just incase we're
building on a machine where they are different.

modules/crypto/argon2d.c

index 72bd30c3ed83567b800c366d34a2e630079c2729..84c25d2f6dcf79796f2701969a28fa0dc4f18695 100644 (file)
 #define ARGON2D_TIMECOST_MAX    16384
 
 #define ATHEME_ARGON2D_LOADB64  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
-#define ATHEME_ARGON2D_LOADSALT "$argon2d$v=19$m=%" PRIu32 ",t=%" PRIu32 ",p=1$%[" ATHEME_ARGON2D_LOADB64 "]$"
+
+// Format strings for (s)scanf(3)
+#define ATHEME_ARGON2D_LOADSALT "$argon2d$v=19$m=%" SCNu32 ",t=%" SCNu32 ",p=1$%[" ATHEME_ARGON2D_LOADB64 "]$"
+
+// Format strings for (sn)printf(3)
 #define ATHEME_ARGON2D_SAVESALT "$argon2d$v=19$m=%" PRIu32 ",t=%" PRIu32 ",p=1$%s$"
 #define ATHEME_ARGON2D_SAVEHASH ATHEME_ARGON2D_SAVESALT "%s"