Alignment issue of iobuf functions

Werner Koch wk at gnupg.org
Fri Jan 8 12:19:57 CET 2016


On Fri,  8 Jan 2016 03:16, gniibe at fsij.org said:

> The API of the function iobuf_desc is somewhat ugly.  And I don't like
> strncpy in general, though.  Since it is an internal function, the

Please use mem2str instead:

   char *mem2str (char *dest, const void *src, size_t n);

   This function is similar to strncpy().  However it won't copy more
   than N - 1 characters and makes sure that a '\0' is appended. With
   N given as 0, nothing will happen.  With DEST given as NULL, memory
   will be allocated using xmalloc (i.e. if it runs out of core
   the function terminates).  Returns DES or a pointer to the
   allocated memory.

> Since this change is needed to GnuPG 1.4 and 2.0 as well, I'd like
> to confirm if this patch is OK to commit.

I don't see a reason to backport it to 2.0.


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-devel mailing list