mirror of
https://github.com/cryptonote-social/csminer.git
synced 2024-09-11 05:35:23 +03:00
fix potential null pointer dereference in login due to malformed response
This commit is contained in:
parent
5bc49e88fb
commit
c5509d787f
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
APPLICATION_NAME = "cryptonote.social Monero miner"
|
APPLICATION_NAME = "cryptonote.social Monero miner"
|
||||||
VERSION_STRING = "0.3.2"
|
VERSION_STRING = "0.3.3"
|
||||||
STATS_WEBPAGE = "https://cryptonote.social/xmr"
|
STATS_WEBPAGE = "https://cryptonote.social/xmr"
|
||||||
DONATE_USERNAME = "donate-getmonero-org"
|
DONATE_USERNAME = "donate-getmonero-org"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
csminer v0.3.2 (Linux/Gnome version)
|
csminer v0.3.3 (Linux/Gnome version)
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
|
|
||||||
|
@ -385,10 +385,10 @@ func MiningLoop(jobChan <-chan *client.MultiClientJob, done chan<- bool) {
|
|||||||
cl.Close()
|
cl.Close()
|
||||||
newChan := reconnectClient()
|
newChan := reconnectClient()
|
||||||
if newChan == nil {
|
if newChan == nil {
|
||||||
|
stopWorkers() // stop hashing if we're unable to reconnect since we can't submit shares
|
||||||
crylog.Info("reconnect failed. sleeping for", sleepSec, "seconds before trying again")
|
crylog.Info("reconnect failed. sleeping for", sleepSec, "seconds before trying again")
|
||||||
time.Sleep(sleepSec)
|
time.Sleep(sleepSec)
|
||||||
sleepSec += time.Second
|
sleepSec += time.Second
|
||||||
stopWorkers() // stop hashing if we're unable to reconnect since we can't submit shares
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Set up fresh stats for new connection
|
// Set up fresh stats for new connection
|
||||||
|
@ -230,13 +230,21 @@ func (cl *Client) Connect(
|
|||||||
return err, 0, "", nil
|
return err, 0, "", nil
|
||||||
}
|
}
|
||||||
if response.Result == nil {
|
if response.Result == nil {
|
||||||
|
if response.Error != nil {
|
||||||
crylog.Error("Didn't get job result from login response:", response.Error)
|
crylog.Error("Didn't get job result from login response:", response.Error)
|
||||||
return errors.New("stratum server error"), response.Error.Code, response.Error.Message, nil
|
return errors.New("stratum server error"), response.Error.Code, response.Error.Message, nil
|
||||||
}
|
}
|
||||||
|
crylog.Error("Malformed login response:", response)
|
||||||
|
return errors.New("malformed login response"), 0, "", nil
|
||||||
|
}
|
||||||
|
|
||||||
cl.responseChannel = make(chan *Response)
|
cl.responseChannel = make(chan *Response)
|
||||||
cl.alive = true
|
cl.alive = true
|
||||||
jc := make(chan *MultiClientJob)
|
jc := make(chan *MultiClientJob)
|
||||||
|
if response.Result.Job == nil {
|
||||||
|
crylog.Error("malformed login response result:", response.Result)
|
||||||
|
return errors.New("malformed login response case 2"), 0, "", nil
|
||||||
|
}
|
||||||
response.Result.Job.ChatToken = response.ChatToken
|
response.Result.Job.ChatToken = response.ChatToken
|
||||||
go dispatchJobs(cl.conn, jc, response.Result.Job, cl.responseChannel)
|
go dispatchJobs(cl.conn, jc, response.Result.Job, cl.responseChannel)
|
||||||
if response.Warning != nil {
|
if response.Warning != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user