mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-02 12:01:32 +01:00
dirmngr: fix for memory alignment.
* dirmngr/dns-stuff.c (get_dns_cert): Cast through void *. (getsrv, get_dns_cname): Make sure it's aligned for HEADER. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
772f6b29b5
commit
6fbe12a51e
@ -821,8 +821,8 @@ get_dns_cert (const char *name, int want_certtype,
|
|||||||
answer, 65536);
|
answer, 65536);
|
||||||
/* Not too big, not too small, no errors and at least 1 answer. */
|
/* Not too big, not too small, no errors and at least 1 answer. */
|
||||||
if (r >= sizeof (HEADER) && r <= 65536
|
if (r >= sizeof (HEADER) && r <= 65536
|
||||||
&& (((HEADER *) answer)->rcode) == NOERROR
|
&& (((HEADER *)(void *) answer)->rcode) == NOERROR
|
||||||
&& (count = ntohs (((HEADER *) answer)->ancount)))
|
&& (count = ntohs (((HEADER *)(void *) answer)->ancount)))
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
unsigned char *pt, *emsg;
|
unsigned char *pt, *emsg;
|
||||||
@ -1081,8 +1081,12 @@ getsrv (const char *name,struct srventry **list)
|
|||||||
}
|
}
|
||||||
#else /*!USE_ADNS*/
|
#else /*!USE_ADNS*/
|
||||||
{
|
{
|
||||||
unsigned char answer[2048];
|
union {
|
||||||
HEADER *header = (HEADER *)answer;
|
unsigned char ans[2048];
|
||||||
|
HEADER header[1];
|
||||||
|
} res;
|
||||||
|
unsigned char *answer = res.ans;
|
||||||
|
HEADER *header = res.header;
|
||||||
unsigned char *pt, *emsg;
|
unsigned char *pt, *emsg;
|
||||||
int r;
|
int r;
|
||||||
u16 dlen;
|
u16 dlen;
|
||||||
@ -1305,8 +1309,12 @@ get_dns_cname (const char *name, char **r_cname)
|
|||||||
}
|
}
|
||||||
#else /*!USE_ADNS*/
|
#else /*!USE_ADNS*/
|
||||||
{
|
{
|
||||||
unsigned char answer[2048];
|
union {
|
||||||
HEADER *header = (HEADER *)answer;
|
unsigned char ans[2048];
|
||||||
|
HEADER header[1];
|
||||||
|
} res;
|
||||||
|
unsigned char *answer = res.ans;
|
||||||
|
HEADER *header = res.header;
|
||||||
unsigned char *pt, *emsg;
|
unsigned char *pt, *emsg;
|
||||||
int r;
|
int r;
|
||||||
char *cname;
|
char *cname;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user