Home GnuPG
Diffusion GnuPG ce11cc39ea7e

common: Minor change of hex2str to allow for embedded nul.
ce11cc39ea7eUnpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

common: Minor change of hex2str to allow for embedded nul.

* common/convert.c (hex2str): Set ERRNO.  Return adjusted COUNT.

hex2str is only used at one place for in-place converting an hex
encoded passphrase. This change does not affect this use. The change
is however useful to use the function for in-place conversion of
arbitrary hex encoded strings.

Take care for in-place conversion of a hex string encoding binary data
you need to use it this way:

if (hex2str (string, string, strlen (string) + 1, &length)
   oops ("probably out of memory but see ERRNO");
for (i=0; i < length; i++)
   foo (string[i));

Note that strlen() + 1.

  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Apr 23 2015, 2:31 PM
Parents
rGa7264e3a6a83: common: removal of t-support.c from t_jnlib_src.
Branches
Unknown
Tags
Unknown

Event Timeline