[PATCH] fix agent/findkey.c
Werner Koch
wk at gnupg.org
Wed Oct 31 14:17:23 CET 2012
On Wed, 31 Oct 2012 08:09, gniibe at fsij.org said:
> It segfaluted in libgcrypt. So, I read the code of
> libgcrypt/src/sexp.c and I realized that the caller should offer
> pointer to the argument.
No, that is not the case.
> - args[argidx++] = (void *)uri_length;
> - args[argidx++] = (void *)uri;
> + args[argidx++] = (void *)&uri_length;
> + args[argidx++] = (void *)&uri;
I would say, this is the correct fix:
+ args[argidx++] = (void *)((int)uri_length);
+ args[argidx++] = (void *)uri;
The format string ("%b") expect an /int/ and an /const char */:
else if (*p == 'b')
{
/* Insert a memory buffer. */
const char *astr;
int alen;
ARG_NEXT (alen, int);
ARG_NEXT (astr, const char *);
Thus the URI_LENGTH needs to be casted from size_t to int first. The
/void*/ requirement is only to fit it into the array.
Shalom-Salam,
Werner
--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gnupg-devel
mailing list