[openssh-commits] [openssh] branch master updated: update getrrsetbyname.c from OpenBSD upstream
git+noreply at mindrot.org
git+noreply at mindrot.org
Tue May 12 14:38:02 AEST 2026
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
The following commit(s) were added to refs/heads/master by this push:
new 67f31cefd update getrrsetbyname.c from OpenBSD upstream
67f31cefd is described below
commit 67f31cefd8ccf0f55f24e806c4dc86b028fa65ff
Author: Damien Miller <djm at mindrot.org>
AuthorDate: Tue May 12 14:36:27 2026 +1000
update getrrsetbyname.c from OpenBSD upstream
revision 1.15
date: 2026/05/09 01:54:51; author: tb; state: Exp; lines: +14 -13; commitid: zZPVUWycKAslGJtO;
Avoid recursive cleanup in getrrsetbyname()
Instead of freeing struct dns_query and struct dns_rr by walking the
linked lists recursively, use a simple loop. This avoids a possible
stack exhaustion unlikely to be reachable with the limits modern
resolvers impose.
From Dhiraj Mishra
---
openbsd-compat/getrrsetbyname.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/openbsd-compat/getrrsetbyname.c b/openbsd-compat/getrrsetbyname.c
index ad35148c9..36e558c2c 100644
--- a/openbsd-compat/getrrsetbyname.c
+++ b/openbsd-compat/getrrsetbyname.c
@@ -595,27 +595,28 @@ parse_dns_rrsection(const u_char *answer, int size, const u_char **cp,
static void
free_dns_query(struct dns_query *p)
{
- if (p == NULL)
- return;
+ struct dns_query *next;
- if (p->name)
+ while (p != NULL) {
+ next = p->next;
free(p->name);
- free_dns_query(p->next);
- free(p);
+ free(p);
+ p = next;
+ }
}
static void
free_dns_rr(struct dns_rr *p)
{
- if (p == NULL)
- return;
+ struct dns_rr *next;
- if (p->name)
+ while (p != NULL) {
+ next = p->next;
free(p->name);
- if (p->rdata)
free(p->rdata);
- free_dns_rr(p->next);
- free(p);
+ free(p);
+ p = next;
+ }
}
static void
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list