Skip to content

Commit

Permalink
- Safeguard alias loop while looking in the cache for expired answers.
Browse files Browse the repository at this point in the history
  • Loading branch information
gthess committed Dec 3, 2024
1 parent be92752 commit b4a9c8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions doc/Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
(1 day) as suggested by RFC8767.
- Merge #1198: Fix log-servfail with serve expired and no useful cache
contents.
- Safeguard alias loop while looking in the cache for expired answers.

22 November 2024: Yorgos
- Fix #1175: serve-expired does not adhere to secure-by-default
Expand Down
9 changes: 5 additions & 4 deletions services/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,7 @@ mesh_serve_expired_callback(void* arg)
struct timeval tv = {0, 0};
int must_validate = (!(qstate->query_flags&BIT_CD)
|| qstate->env->cfg->ignore_cd) && qstate->env->need_to_validate;
int i = 0;
int i = 0, for_count;
int is_expired;
if(!qstate->serve_expired_data) return;
verbose(VERB_ALGO, "Serve expired: Trying to reply with expired data");
Expand All @@ -2196,9 +2196,10 @@ mesh_serve_expired_callback(void* arg)
"Serve expired: Not allowed to look into cache for stale");
return;
}
/* The following while is used instead of the `goto lookup_cache`
* like in the worker. */
while(1) {
/* The following for is used instead of the `goto lookup_cache`
* like in the worker. This loop should get max 2 passes if we need to
* do any aliasing. */
for(for_count = 0; for_count < 2; for_count++) {
fptr_ok(fptr_whitelist_serve_expired_lookup(
qstate->serve_expired_data->get_cached_answer));
msg = (*qstate->serve_expired_data->get_cached_answer)(qstate,
Expand Down

0 comments on commit b4a9c8b

Please sign in to comment.