mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 08:17:37 +00:00
Require 64/16 characters for payment ids
The default behavior for hex string parsing would allow the last digit to be made from a single hexadecimal character, which is correct, but we typically do not want that as it gets confusing and easy to not spot wrong input size.
This commit is contained in:
parent
30ef965f9a
commit
f8213c0644
1 changed files with 3 additions and 1 deletions
|
@ -139,9 +139,11 @@ namespace string_tools
|
|||
}
|
||||
//----------------------------------------------------------------------------
|
||||
template<class CharT>
|
||||
bool parse_hexstr_to_binbuff(const std::basic_string<CharT>& s, std::basic_string<CharT>& res)
|
||||
bool parse_hexstr_to_binbuff(const std::basic_string<CharT>& s, std::basic_string<CharT>& res, bool allow_partial_byte = false)
|
||||
{
|
||||
res.clear();
|
||||
if (!allow_partial_byte && (s.size() & 1))
|
||||
return false;
|
||||
try
|
||||
{
|
||||
long v = 0;
|
||||
|
|
Loading…
Reference in a new issue