1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-05-28 21:50:02 +02:00

* gpgkeys_hkp.c (get_key, handle_old_hkp_index, search_key): Properly

handle line truncation.
This commit is contained in:
David Shaw 2002-09-19 17:03:42 +00:00
parent 2761544fb4
commit 5e802a7256
2 changed files with 17 additions and 5 deletions

View File

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

View File

@ -191,11 +191,9 @@ int
get_key(char *getkey) get_key(char *getkey)
{ {
int rc,gotit=0; int rc,gotit=0;
unsigned int maxlen=1024,buflen=0;
char search[29]; char search[29];
char *request; char *request;
struct http_context hd; struct http_context hd;
byte *line=NULL;
/* Build the search string. HKP only uses the short key IDs. */ /* Build the search string. HKP only uses the short key IDs. */
@ -255,8 +253,13 @@ get_key(char *getkey)
} }
else else
{ {
unsigned int maxlen=1024,buflen;
byte *line=NULL;
while(iobuf_read_line(hd.fp_read,&line,&buflen,&maxlen)) while(iobuf_read_line(hd.fp_read,&line,&buflen,&maxlen))
{ {
maxlen=1024;
if(gotit) if(gotit)
{ {
fprintf(output,line); fprintf(output,line);
@ -278,9 +281,10 @@ get_key(char *getkey)
fprintf(console,"gpgkeys: key %s not found on keyserver\n",getkey); fprintf(console,"gpgkeys: key %s not found on keyserver\n",getkey);
fprintf(output,"KEY 0x%s FAILED\n",getkey); fprintf(output,"KEY 0x%s FAILED\n",getkey);
} }
m_free(line);
} }
m_free(line);
free(request); free(request);
return 0; return 0;
@ -534,12 +538,14 @@ void
handle_old_hkp_index(IOBUF input) handle_old_hkp_index(IOBUF input)
{ {
int ret,rc,count=0; int ret,rc,count=0;
unsigned int maxlen=1024,buflen=0; unsigned int buflen;
byte *line=NULL; byte *line=NULL;
IOBUF buffer=iobuf_temp(); IOBUF buffer=iobuf_temp();
do do
{ {
unsigned int maxlen=1024;
/* This is a judgement call. Is it better to slurp up all the /* This is a judgement call. Is it better to slurp up all the
results before prompting the user? On the one hand, it results before prompting the user? On the one hand, it
probably makes the keyserver happier to not be blocked on probably makes the keyserver happier to not be blocked on
@ -630,7 +636,7 @@ search_key(char *searchkey)
} }
else else
{ {
unsigned int maxlen=1024,buflen=0; unsigned int maxlen=1024,buflen;
byte *line=NULL; byte *line=NULL;
/* Is it a pksd that knows how to handle machine-readable /* Is it a pksd that knows how to handle machine-readable
@ -643,6 +649,7 @@ search_key(char *searchkey)
do do
{ {
fprintf(output,"%s",line); fprintf(output,"%s",line);
maxlen=1024;
rc=iobuf_read_line(hd.fp_read,&line,&buflen,&maxlen); rc=iobuf_read_line(hd.fp_read,&line,&buflen,&maxlen);
} }
while(rc!=0); while(rc!=0);