]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* modules/aaa/mod_auth_digest.c (client_generate): Skip a client id
authorJoe Orton <jorton@apache.org>
Thu, 13 Aug 2026 15:16:01 +0000 (15:16 +0000)
committerJoe Orton <jorton@apache.org>
Thu, 13 Aug 2026 15:16:01 +0000 (15:16 +0000)
  of zero, which the counter hands out once it wraps: zero means "no
  client", so add_client() refuses it.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: PR #705

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937109 13f79535-47bb-0310-9956-ffa450edef68

modules/aaa/mod_auth_digest.c

index a85a8c973122f5d1cb24d8a37325b1dea664ea77..50cd0961d5569d705ce57551b8bb0dce37bb79b6 100644 (file)
@@ -1149,6 +1149,12 @@ static client_id_t client_generate(const request_rec *r)
     client_id_t op = apr_atomic_inc32(client_id_counter);
     client_entry new_entry = { 0, NULL, 0, 0 };
 
+    /* The counter wraps after 2^32 clients: skip an id of zero, which means
+     * "no client" and which add_client() would refuse. */
+    if (op == 0) {
+        op = apr_atomic_inc32(client_id_counter);
+    }
+
     if (!add_client(op, &new_entry, r->server)) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01769)
                       "unable to allocate a client entry - failing the "