Add safety check.
Change return values of string_tohex() and string_fromhex() to return number of characters processed instead of a pointer to the result buffer.
Adjust tests to also check return values of string_tohex() and string_fromhex().