diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-06-06 11:40:03 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-06-06 11:40:03 +0200 |
commit | bb5b2ed9b340192e75ca473a8e3e302b112f0ba1 (patch) | |
tree | 52f78fc52710651c157ff26e75bde881803280c5 /libbutl/uuid.cxx | |
parent | 3282252e09d960108cea00dc464799111be42220 (diff) |
Sync uuid code with libstud-uuid
Diffstat (limited to 'libbutl/uuid.cxx')
-rw-r--r-- | libbutl/uuid.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/libbutl/uuid.cxx b/libbutl/uuid.cxx index 377afb7..2132808 100644 --- a/libbutl/uuid.cxx +++ b/libbutl/uuid.cxx @@ -5,7 +5,7 @@ #include <errno.h> // ENOTSUP -#include <cstdio> // sprintf() scanf() +#include <cstdio> // snprintf() sscanf() #include <cstring> // strlen() #include <stdexcept> #include <system_error> @@ -19,16 +19,17 @@ namespace butl { array<char, 37> r; - sprintf (r.data (), - (upper - ? "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" - : "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"), - time_low, - time_mid, - time_hiv, - clock_seq_hir, - clock_seq_low, - node[0], node[1], node[2], node[3], node[4], node[5]); + snprintf (r.data (), + 37, + (upper + ? "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" + : "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"), + time_low, + time_mid, + time_hiv, + clock_seq_hir, + clock_seq_low, + node[0], node[1], node[2], node[3], node[4], node[5]); return r; } |