core: Fix segv in genkey when no endtag is provided.
* src/genkey.c (get_key_parameter): Provide a fallback ENDTAG. -- It would actually be more correct to return an error in this case but it is possible tha there are users who did not provide an endtag and out of luck they also didn't trigger a segv. GnuPG-bug-id: 4192 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
174af15725
commit
fbac11b19d
@ -223,9 +223,13 @@ get_key_parameter (const char *parms, gpgme_data_t *key_parameter)
|
|||||||
return gpg_error (GPG_ERR_INV_VALUE);
|
return gpg_error (GPG_ERR_INV_VALUE);
|
||||||
|
|
||||||
endtag = strstr (content, "</GnupgKeyParms>");
|
endtag = strstr (content, "</GnupgKeyParms>");
|
||||||
|
if (!endtag)
|
||||||
|
endtag = content + strlen (content);
|
||||||
|
|
||||||
/* FIXME: Check that there are no control statements inside. */
|
/* FIXME: Check that there are no control statements inside. */
|
||||||
while (content[0] == '\n'
|
while (content < endtag
|
||||||
|| (content[0] == '\r' && content[1] == '\n'))
|
&& (content[0] == '\n'
|
||||||
|
|| (content[0] == '\r' && content[1] == '\n')))
|
||||||
content++;
|
content++;
|
||||||
|
|
||||||
return gpgme_data_new_from_mem (key_parameter, content,
|
return gpgme_data_new_from_mem (key_parameter, content,
|
||||||
|
Loading…
Reference in New Issue
Block a user