89c94b
diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c
89c94b
index b760941..0825b1b 100644
89c94b
--- a/modules/aaa/mod_auth_digest.c
89c94b
+++ b/modules/aaa/mod_auth_digest.c
89c94b
@@ -1422,9 +1422,14 @@ static int check_nonce(request_rec *r, digest_header_rec *resp,
89c94b
     time_rec nonce_time;
89c94b
     char tmp, hash[NONCE_HASH_LEN+1];
89c94b
 
89c94b
-    if (strlen(resp->nonce) != NONCE_LEN) {
89c94b
+    /* Since the time part of the nonce is a base64 encoding of an
89c94b
+     * apr_time_t (8 bytes), it should end with a '=', fail early otherwise.
89c94b
+     */
89c94b
+    if (strlen(resp->nonce) != NONCE_LEN
89c94b
+            || resp->nonce[NONCE_TIME_LEN - 1] != '=') {
89c94b
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01775)
89c94b
-                      "invalid nonce %s received - length is not %d",
89c94b
+                      "invalid nonce '%s' received - length is not %d "
89c94b
+                      "or time encoding is incorrect",
89c94b
                       resp->nonce, NONCE_LEN);
89c94b
         note_digest_auth_failure(r, conf, resp, 1);
89c94b
         return HTTP_UNAUTHORIZED;