valgrind complains mpicoder.c:273

Werner Koch wk at
Mon Aug 20 09:47:56 CEST 2012

On Sun, 19 Aug 2012 12:55, rik at said:

>  for (p=buffer; !*p && *nbytes; p++, --*nbytes)
> In the case of getting a buffer with *nbytes == 0, *p will be
> uninitialized. 

Sorry, I can't see that.  At the top of the function we have:

  n = *nbytes? *nbytes:1; /* Allocate at least one byte.  */
  p = buffer = (force_secure || mpi_is_secure(a))? gcry_malloc_secure (n)
						 : gcry_malloc (n);

Thus there will always be a valid p[0].



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gcrypt-devel mailing list