mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
common/
2010-04-20 Marcus Brinkmann <marcus@g10code.de> * logging.c (do_log_ignore_arg): New helper function. (log_string): Use it to remove ugly volatile hack that causes gcc warning. (log_flush): Likewise. * sysutils.c (gnupg_unsetenv) [!HAVE_W32CE_SYSTEM]: Return something. (gnupg_setenv) [!HAVE_W32CE_SYSTEM]: Likewise. * pka.c (get_pka_info): Solve strict aliasing rule violation. * t-exechelp.c (test_close_all_fds): Use dummy variables to silence gcc warning. kbx/ 2010-04-20 Marcus Brinkmann <marcus@g10code.de> * keybox-update.c [!HAVE_DOSISH_SYSTEM]: Include ../common/sysutils.h even then to silence gcc warning about missing declaration of gnupg_remove. tools/ 2010-04-20 Marcus Brinkmann <marcus@g10code.de> * gpgconf-comp.c (option_check_validity): Use dummy variables to silence gcc warning.
This commit is contained in:
parent
6616ba9a1e
commit
0e960d940a
10 changed files with 77 additions and 35 deletions
20
common/pka.c
20
common/pka.c
|
@ -180,7 +180,7 @@ get_pka_info (const char *address, unsigned char *fpr)
|
|||
unsigned char *p, *pend;
|
||||
const char *domain;
|
||||
char *name;
|
||||
|
||||
HEADER header;
|
||||
|
||||
domain = strrchr (address, '@');
|
||||
if (!domain || domain == address || !domain[1])
|
||||
|
@ -196,18 +196,24 @@ get_pka_info (const char *address, unsigned char *fpr)
|
|||
xfree (name);
|
||||
if (anslen < sizeof(HEADER))
|
||||
return NULL; /* DNS resolver returned a too short answer. */
|
||||
if ( (rc=((HEADER*)answer)->rcode) != NOERROR )
|
||||
|
||||
/* Don't despair: A good compiler should optimize this away, as
|
||||
header is just 32 byte and constant at compile time. It's
|
||||
one way to comply with strict aliasing rules. */
|
||||
memcpy (&header, answer, sizeof (header));
|
||||
|
||||
if ( (rc=header.rcode) != NOERROR )
|
||||
return NULL; /* DNS resolver returned an error. */
|
||||
|
||||
/* We assume that PACKETSZ is large enough and don't do dynmically
|
||||
expansion of the buffer. */
|
||||
if (anslen > PACKETSZ)
|
||||
return NULL; /* DNS resolver returned a too long answer */
|
||||
|
||||
qdcount = ntohs (((HEADER*)answer)->qdcount);
|
||||
ancount = ntohs (((HEADER*)answer)->ancount);
|
||||
nscount = ntohs (((HEADER*)answer)->nscount);
|
||||
arcount = ntohs (((HEADER*)answer)->arcount);
|
||||
|
||||
qdcount = ntohs (header.qdcount);
|
||||
ancount = ntohs (header.ancount);
|
||||
nscount = ntohs (header.nscount);
|
||||
arcount = ntohs (header.arcount);
|
||||
|
||||
if (!ancount)
|
||||
return NULL; /* Got no answer. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue