check SplitN() return value to prevent indexing beyond end of slice
This commit is contained in:
parent
ad739ce055
commit
824cb8dc8e
|
@ -304,6 +304,9 @@ func (s *lwdStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawT
|
|||
// For some reason, the error responses are not JSON
|
||||
if rpcErr != nil {
|
||||
errParts := strings.SplitN(rpcErr.Error(), ":", 2)
|
||||
if len(errParts) < 2 {
|
||||
return nil, errors.New("SendTransaction couldn't parse error code")
|
||||
}
|
||||
errMsg = strings.TrimSpace(errParts[1])
|
||||
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue