mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-23 20:08:04 +01:00
Fix bug#1307
This is a backport of the fixes for 2.0. There is only one real bug, the other changes are for clarity and for more picky compilers.
This commit is contained in:
parent
4fb59b1313
commit
c156a636c6
@ -1,3 +1,10 @@
|
|||||||
|
2011-08-09 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* keygen.c (ask_user_id): Fix loop break condition. See bug#1307.
|
||||||
|
|
||||||
|
* import.c (import_keys_internal): Make breaking the loop more
|
||||||
|
explicit. See bug#1307.
|
||||||
|
|
||||||
2011-07-22 Werner Koch <wk@g10code.com>
|
2011-07-22 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* parse-packet.c (parse_key): Print the decoded iteration count.
|
* parse-packet.c (parse_key): Print the decoded iteration count.
|
||||||
|
@ -175,10 +175,9 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames,
|
|||||||
rc = import( inp, "[stream]", stats, fpr, fpr_len, options);
|
rc = import( inp, "[stream]", stats, fpr, fpr_len, options);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( !fnames && !nnames )
|
int once = (!fnames && !nnames);
|
||||||
nnames = 1; /* Ohh what a ugly hack to jump into the loop */
|
|
||||||
|
|
||||||
for(i=0; i < nnames; i++ ) {
|
for(i=0; once || i < nnames; once=0, i++ ) {
|
||||||
const char *fname = fnames? fnames[i] : NULL;
|
const char *fname = fnames? fnames[i] : NULL;
|
||||||
IOBUF inp2 = iobuf_open(fname);
|
IOBUF inp2 = iobuf_open(fname);
|
||||||
if( !fname )
|
if( !fname )
|
||||||
@ -201,8 +200,6 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames,
|
|||||||
log_error("import from `%s' failed: %s\n", fname,
|
log_error("import from `%s' failed: %s\n", fname,
|
||||||
g10_errstr(rc) );
|
g10_errstr(rc) );
|
||||||
}
|
}
|
||||||
if( !fname )
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!stats_handle) {
|
if (!stats_handle) {
|
||||||
|
@ -1971,7 +1971,7 @@ ask_user_id( int mode )
|
|||||||
xfree(answer);
|
xfree(answer);
|
||||||
}
|
}
|
||||||
xfree(answer);
|
xfree(answer);
|
||||||
if( !amail && !acomment && !amail )
|
if( !aname && !acomment && !amail )
|
||||||
break;
|
break;
|
||||||
xfree(uid); uid = NULL;
|
xfree(uid); uid = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2011-08-09 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* pka.c (get_pka_info): Turn ANSWER into a union to avoid aliasing
|
||||||
|
problems with modern compilers. See bug#1307. Reported by Steve
|
||||||
|
Grubb.
|
||||||
|
|
||||||
2010-10-27 Werner Koch <wk@g10code.com>
|
2010-10-27 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* miscutil.c (INVALID_TIME_CHECK): New.
|
* miscutil.c (INVALID_TIME_CHECK): New.
|
||||||
|
22
util/pka.c
22
util/pka.c
@ -116,7 +116,11 @@ parse_txt_record (char *buffer, unsigned char *fpr)
|
|||||||
char *
|
char *
|
||||||
get_pka_info (const char *address, unsigned char *fpr)
|
get_pka_info (const char *address, unsigned char *fpr)
|
||||||
{
|
{
|
||||||
unsigned char answer[PACKETSZ];
|
union
|
||||||
|
{
|
||||||
|
signed char p[PACKETSZ];
|
||||||
|
HEADER h;
|
||||||
|
} answer;
|
||||||
int anslen;
|
int anslen;
|
||||||
int qdcount, ancount, nscount, arcount;
|
int qdcount, ancount, nscount, arcount;
|
||||||
int rc;
|
int rc;
|
||||||
@ -133,11 +137,11 @@ get_pka_info (const char *address, unsigned char *fpr)
|
|||||||
memcpy (name, address, domain - address);
|
memcpy (name, address, domain - address);
|
||||||
strcpy (stpcpy (name + (domain-address), "._pka."), domain+1);
|
strcpy (stpcpy (name + (domain-address), "._pka."), domain+1);
|
||||||
|
|
||||||
anslen = res_query (name, C_IN, T_TXT, answer, PACKETSZ);
|
anslen = res_query (name, C_IN, T_TXT, answer.p, PACKETSZ);
|
||||||
xfree (name);
|
xfree (name);
|
||||||
if (anslen < sizeof(HEADER))
|
if (anslen < sizeof(HEADER))
|
||||||
return NULL; /* DNS resolver returned a too short answer. */
|
return NULL; /* DNS resolver returned a too short answer. */
|
||||||
if ( (rc=((HEADER*)answer)->rcode) != NOERROR )
|
if ( (rc=answer.h.rcode) != NOERROR )
|
||||||
return NULL; /* DNS resolver returned an error. */
|
return NULL; /* DNS resolver returned an error. */
|
||||||
|
|
||||||
/* We assume that PACKETSZ is large enough and don't do dynmically
|
/* We assume that PACKETSZ is large enough and don't do dynmically
|
||||||
@ -145,16 +149,16 @@ get_pka_info (const char *address, unsigned char *fpr)
|
|||||||
if (anslen > PACKETSZ)
|
if (anslen > PACKETSZ)
|
||||||
return NULL; /* DNS resolver returned a too long answer */
|
return NULL; /* DNS resolver returned a too long answer */
|
||||||
|
|
||||||
qdcount = ntohs (((HEADER*)answer)->qdcount);
|
qdcount = ntohs (answer.h.qdcount);
|
||||||
ancount = ntohs (((HEADER*)answer)->ancount);
|
ancount = ntohs (answer.h.ancount);
|
||||||
nscount = ntohs (((HEADER*)answer)->nscount);
|
nscount = ntohs (answer.h.nscount);
|
||||||
arcount = ntohs (((HEADER*)answer)->arcount);
|
arcount = ntohs (answer.h.arcount);
|
||||||
|
|
||||||
if (!ancount)
|
if (!ancount)
|
||||||
return NULL; /* Got no answer. */
|
return NULL; /* Got no answer. */
|
||||||
|
|
||||||
p = answer + sizeof (HEADER);
|
p = answer.p + sizeof (HEADER);
|
||||||
pend = answer + anslen; /* Actually points directly behind the buffer. */
|
pend = answer.p + anslen; /* Actually points directly behind the buffer. */
|
||||||
|
|
||||||
while (qdcount-- && p < pend)
|
while (qdcount-- && p < pend)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user