Currently, we successfully parse descriptors which contains spaces in the beginning or end of the public key within a fragment (e.g. pk( KEY)
, pk(KEY )
or pk( KEY )
). I have noticed that one of the reasons is that the DecodeBase58
function simply ignore these whitespaces.
This PR changes the ParsePubkeyInner
to reject pubkeys that contain a whitespace at the beginning and/or at the end. We will only check the whitespace in some RPCs (e.g. importdescriptors
), but an already imported descriptor won’t be affected by this check, especially because we store descriptors from ToString
.
For context: https://github.com/brunoerg/bitcoinfuzz/issues/72