Skip to content

Commit

Permalink
httpauth: use fixed length integers for printing timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
cHuberCoffee committed Aug 30, 2023
1 parent e8d65a7 commit a9856fc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/httpauth/digest.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,10 @@ static int generate_nonce(char **pnonce, const time_t ts,
__FILE__, __LINE__, __func__);

if (str_isset(secret))
err = mbuf_printf(mb, "%lu:%s:%s",
(long unsigned)ts, etag, secret);
err = mbuf_printf(mb, "%016"PRIx64":%s:%s",
(uint64_t)ts, etag, secret);
else
err = mbuf_printf(mb, "%lu:%s", (long unsigned)ts, etag);
err = mbuf_printf(mb, "%016"PRIx64":%s", (uint64_t)ts, etag);

if (err) {
DEBUG_WARNING("[%s:%d-%s] Error while writing memory"
Expand Down Expand Up @@ -499,7 +499,8 @@ static int generate_nonce(char **pnonce, const time_t ts,
DEBUG_INFO("[%s:%d-%s] "
"Memory buffer before writing hash + timestamp %H\n",
__FILE__, __LINE__, __func__, mbuf_debug, mb);
err = mbuf_printf(mb, "%w%016lx", hash, hashlen, (long unsigned)ts);
err = mbuf_printf(mb, "%w%016"PRIx64"", hash, hashlen, (uint64_t)ts);

DEBUG_INFO("[%s:%d-%s] "
"Memory buffer after writing hash + timestamp %H\n",
__FILE__, __LINE__, __func__, mbuf_debug, mb);
Expand Down

0 comments on commit a9856fc

Please sign in to comment.