mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
swarm/pss: Add address check in sendRaw
This commit is contained in:
parent
4104dd035e
commit
05eae4f312
2 changed files with 9 additions and 0 deletions
|
|
@ -759,6 +759,9 @@ func (p *Pss) enqueue(msg *PssMsg) error {
|
|||
//
|
||||
// Will fail if raw messages are disallowed
|
||||
func (p *Pss) SendRaw(address PssAddress, topic Topic, msg []byte) error {
|
||||
if !checkAddress(&address) {
|
||||
return errors.New("invalid address")
|
||||
}
|
||||
pssMsgParams := &msgParams{
|
||||
raw: true,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1028,6 +1028,12 @@ func TestApi(t *testing.T) {
|
|||
if err == nil {
|
||||
t.Fatal("expected error on empty msg")
|
||||
}
|
||||
|
||||
overflowAddr := [33]byte{}
|
||||
err = clients[0].Call(nil, "pss_sendRaw", hexutil.Encode(overflowAddr[:]), topic, "0x666f6f")
|
||||
if err == nil {
|
||||
t.Fatal("expected error on send too big address")
|
||||
}
|
||||
}
|
||||
|
||||
// verifies that nodes can send and receive raw (verbatim) messages
|
||||
|
|
|
|||
Loading…
Reference in a new issue