1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

* gpgkeys_hkp.c (get_key, search_key): Properly handle line truncation.

This commit is contained in:
David Shaw 2002-09-19 16:51:59 +00:00
parent 908329f6bd
commit f76dc1d602
2 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2002-09-19 David Shaw <dshaw@jabberwocky.com>
* gpgkeys_hkp.c (get_key, search_key): Properly handle line
truncation.
2002-09-16 David Shaw <dshaw@jabberwocky.com>
* gpgkeys_mailto.in: Add quasi-RFC-2368 mailto:email@addr?from=

View File

@ -185,11 +185,9 @@ int send_key(void)
int get_key(char *getkey)
{
int rc,gotit=0;
unsigned int maxlen=1024,buflen=0;
char search[29];
char *request;
struct http_context hd;
byte *line=NULL;
/* Build the search string. HKP only uses the short key IDs. */
@ -249,8 +247,13 @@ int get_key(char *getkey)
}
else
{
unsigned int maxlen=1024,buflen;
byte *line=NULL;
while(iobuf_read_line(hd.fp_read,&line,&buflen,&maxlen))
{
maxlen=1024;
if(gotit)
{
fprintf(output,line);
@ -272,9 +275,10 @@ int get_key(char *getkey)
fprintf(console,"gpgkeys: key %s not found on keyserver\n",getkey);
fprintf(output,"KEY 0x%s FAILED\n",getkey);
}
m_free(line);
}
m_free(line);
free(request);
return 0;
@ -529,7 +533,6 @@ int search_key(char *searchkey)
int max=0,len=0,ret=-1,rc;
struct http_context hd;
char *search=NULL,*request=searchkey;
byte *line=NULL;
fprintf(output,"SEARCH %s BEGIN\n",searchkey);
@ -587,9 +590,10 @@ int search_key(char *searchkey)
}
else
{
unsigned int maxlen=1024,buflen=0;
unsigned int buflen;
int count=1;
IOBUF buffer;
byte *line=NULL;
buffer=iobuf_temp();
@ -597,6 +601,8 @@ int search_key(char *searchkey)
while(rc!=0)
{
unsigned int maxlen=1024;
/* This is a judgement call. Is it better to slurp up all
the results before prompting the user? On the one hand,
it probably makes the keyserver happier to not be blocked