mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 20:47:10 +11:00
🐛 GetLogs Seg fault out range seg
This commit is contained in:
parent
7e76c668f2
commit
4f657a3ecd
3 changed files with 13 additions and 17 deletions
|
|
@ -4,13 +4,6 @@
|
||||||
"address": "0.0.0.0",
|
"address": "0.0.0.0",
|
||||||
"port": 80,
|
"port": 80,
|
||||||
"https": false
|
"https": false
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "0.0.0.0",
|
|
||||||
"port": 443,
|
|
||||||
"https": true,
|
|
||||||
"cert": "",
|
|
||||||
"key": ""
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -161,18 +161,21 @@ public:
|
||||||
{
|
{
|
||||||
Json::Value res = -1;
|
Json::Value res = -1;
|
||||||
users.if_contains(name, [&res](const User &u) {
|
users.if_contains(name, [&res](const User &u) {
|
||||||
uint32_t j;
|
if (u.log.data.size())
|
||||||
for (uint32_t i = u.log.data.size() - 1; i > 0; --i)
|
|
||||||
{
|
{
|
||||||
j = u.log.data.size() - 1 - i;
|
uint32_t j;
|
||||||
if (!u.log.data[i].amount)
|
for (uint32_t i = u.log.data.size() - 1; i > 0; --i)
|
||||||
{
|
{
|
||||||
return;
|
j = u.log.data.size() - 1 - i;
|
||||||
|
if (!u.log.data[i].amount)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res[j]["to"] = u.log.data[i].to;
|
||||||
|
res[j]["from"] = u.log.data[i].from;
|
||||||
|
res[j]["amount"] = u.log.data[i].amount;
|
||||||
|
res[j]["time"] = (Json::UInt64)u.log.data[i].time;
|
||||||
}
|
}
|
||||||
res[j]["to"] = u.log.data[i].to;
|
|
||||||
res[j]["from"] = u.log.data[i].from;
|
|
||||||
res[j]["amount"] = u.log.data[i].amount;
|
|
||||||
res[j]["time"] = (Json::UInt64)u.log.data[i].time;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
|
|
|
||||||
2
main.cpp
2
main.cpp
|
|
@ -44,7 +44,7 @@ int main(int argc, char **argv)
|
||||||
[](const drogon::HttpRequestPtr &req, const drogon::HttpResponsePtr &resp) {
|
[](const drogon::HttpRequestPtr &req, const drogon::HttpResponsePtr &resp) {
|
||||||
resp->addHeader("Access-Control-Allow-Origin", "*");
|
resp->addHeader("Access-Control-Allow-Origin", "*");
|
||||||
});
|
});
|
||||||
app().loadConfigFile("../config.json").registerController(API).setThreadNum(std::stoul(argv[3])).enableRunAsDaemon().run();
|
app().loadConfigFile("../config.json").registerController(API).setThreadNum(std::stoul(argv[3])).run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue