github-vet / github-vet/rangeloop-pointer-findings
markzhai/GoWebServer: router_deal.go; 73 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [markzhai/GoWebServer](https://www.github.com/markzhai/GoWebServer) at [router_deal.go](https://github.com/markzhai/GoWebServer/blob/572a5f624f7fcdd57a292be5768ea1d31fefa926/router_deal.go#L800-L872)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
>
[Click here to see the code in its original context.](https://github.com/markzhai/GoWebServer/blob/572a5f624f7fcdd57a292be5768ea1d31fefa926/router_deal.go#L800-L872)
Click here to show the 73 line(s) of Go which triggered the analyzer.
```go
for _, o := range offers {
if o.UserID != dsh.UserID {
continue
}
args["own_type"] = o.OwnType
args["vested"] = o.Vested
args["restrictions"] = o.Restrictions
args["shares_total_own"] = o.SharesTotalOwn
args["stock_type"] = o.StockType
args["exercise_date"] = o.ExerciseDate
args["exercise_price"] = o.ExercisePrice
args["shares_to_sell"] = o.SharesToSell
args["desire_price"] = o.DesirePrice
// Return files if available
files := map[string]interface{}{}
pifc := path.Join(dataDir, "deal", fmt.Sprintf("%v", o.DealID),
fmt.Sprintf("%v", u.ID), "share_certificate")
if _, err := os.Stat(pifc); err == nil {
o.ShareCertificateToken, _ =
createFileTokenName("share_certificate", "")
files["share_certificate"] = o.ShareCertificateToken
files["share_certificate_filename"] = o.ShareCertificateName
}
pifc = path.Join(dataDir, "deal", fmt.Sprintf("%v", o.DealID),
fmt.Sprintf("%v", u.ID), "company_by_laws")
if _, err := os.Stat(pifc); err == nil {
o.CompanyByLawsToken, _ =
createFileTokenName("company_by_laws", "")
files["company_by_laws"] = o.CompanyByLawsToken
files["company_by_laws_filename"] = o.CompanyByLawsName
}
pifc = path.Join(dataDir, "deal", fmt.Sprintf("%v", o.DealID),
fmt.Sprintf("%v", u.ID), "shareholder_agreement")
if _, err := os.Stat(pifc); err == nil {
o.ShareholderAgreementToken, _ =
createFileTokenName("shareholder_agreement", "")
files["shareholder_agreement"] = o.ShareholderAgreementToken
files["shareholder_agreement_filename"] = o.ShareholderAgreementName
}
pifc = path.Join(dataDir, "deal", fmt.Sprintf("%v", o.DealID),
fmt.Sprintf("%v", u.ID), "stock_option_plan")
if _, err := os.Stat(pifc); err == nil {
o.StockOptionPlanToken, _ =
createFileTokenName("stock_option_plan", "")
files["stock_option_plan"] = o.StockOptionPlanToken
files["stock_option_plan_filename"] = o.StockOptionPlanName
}
// Check and save
if len(files) > 0 && dbConn.Save(&o).Error == nil {
for k, v := range files {
args[k] = v
}
}
// Return bank information if filled
if dsh.DealShareholderState >= DealShareholderStateBankInfoSubmitted {
var b Bank
if dbConn.Model(dsh).Related(&b).Error != nil {
formatReturn(w, r, ps, ErrorCodeDealNoBankInfo, true, nil)
return
}
args["full_name"] = b.FullName
args["nick_name"] = b.NickName
args["routing_number"] = decField(b.RoutingNumberEncrypted)
args["account_number"] = decField(b.AccountNumberEncrypted)
args["account_type"] = b.AccountType
}
saveLogin(w, r, ps, false, u, args)
return
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {Save 1} was not found in the callgraph; reference was passed directly to third-party code
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 572a5f624f7fcdd57a292be5768ea1d31fefa926
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.