[openssh-commits] [openssh] branch master updated: sync getrrsetbyname.c with recent upstream changes
git+noreply at mindrot.org
git+noreply at mindrot.org
Wed May 8 09:44:23 AEST 2024
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 6a42b70e sync getrrsetbyname.c with recent upstream changes
6a42b70e is described below
commit 6a42b70e56bef1aacdcdf06352396e837883e84f
Author: Damien Miller <djm at mindrot.org>
AuthorDate: Wed May 8 09:43:59 2024 +1000
sync getrrsetbyname.c with recent upstream changes
---
openbsd-compat/getrrsetbyname.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/openbsd-compat/getrrsetbyname.c b/openbsd-compat/getrrsetbyname.c
index 8f593984..ad35148c 100644
--- a/openbsd-compat/getrrsetbyname.c
+++ b/openbsd-compat/getrrsetbyname.c
@@ -328,13 +328,14 @@ getrrsetbyname(const char *hostname, unsigned int rdclass,
if (rdata) {
rdata->rdi_length = rr->size;
- rdata->rdi_data = malloc(rr->size);
-
- if (rdata->rdi_data == NULL) {
- result = ERRSET_NOMEMORY;
- goto fail;
+ if (rr->size != 0) {
+ rdata->rdi_data = malloc(rr->size);
+ if (rdata->rdi_data == NULL) {
+ result = ERRSET_NOMEMORY;
+ goto fail;
+ }
+ memcpy(rdata->rdi_data, rr->rdata, rr->size);
}
- memcpy(rdata->rdi_data, rr->rdata, rr->size);
}
}
free_dns_response(response);
@@ -577,12 +578,13 @@ parse_dns_rrsection(const u_char *answer, int size, const u_char **cp,
/* rdata itself */
NEED(curr->size);
- curr->rdata = malloc(curr->size);
- if (curr->rdata == NULL) {
- free_dns_rr(head);
- return (NULL);
+ if (curr->size != 0) {
+ if ((curr->rdata = malloc(curr->size)) == NULL) {
+ free_dns_rr(head);
+ return (NULL);
+ }
+ memcpy(curr->rdata, *cp, curr->size);
}
- memcpy(curr->rdata, *cp, curr->size);
*cp += curr->size;
}
#undef NEED
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list