Extra zero byte converting mpz_t to a string

Hans Aberg haberg-1 at telia.com
Sat Apr 18 16:58:55 UTC 2015


> On 18 Apr 2015, at 13:40, tg at gmplib.org wrote:

> No GMP bug, bug in user program.

The manual does not seem to say what should be used in the GMP deallocator length l argument if one wants it to always work, as in this code:
  char* cs = mpz_get_str(NULL, b, z);
  ..
  free_function(cs, l);
Possibly one should use l = strlen(cs) + 1, but then that has to be computed also when not used.



More information about the gmp-bugs mailing list