Skip to content

RPC 'sendfrom' with invalid address crashes bitcoind #447

@dooglus

Description

@dooglus

$ bitcoind sendfrom '' a1 1
error: no response from server

I compiled with debugging, and it crashed on an assert() in bash58.h:
#2 0x00000037510296e6 in __assert_fail () from /lib64/libc.so.6
#3 0x00000000004dd82e in CBitcoinAddress::GetHash160 (this=0x41801170)

at base58.h:300

#4 0x00000000004dd886 in CScript::SetBitcoinAddress (this=0x41800e40,

address=...) at script.h:643

#5 0x00000000004ca57d in CWallet::SendMoneyToBitcoinAddress (this=0x1276e70,

address=..., nValue=1, wtxNew=..., fAskFee=false) at wallet.cpp:1122

#6 0x00000000004f7c42 in sendfrom (params=..., fHelp=false) at rpc.cpp:834
#7 0x00000000004fec0c in ThreadRPCServer2 (parg=0x0) at rpc.cpp:2232

Do we need to check address.IsValid() in rpc.cpp before calling SendMoneyToBitcoinAddress()?

I think other RPC calls which take an address have the same problem too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions