mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Fix occurences of c_str() used with size() to data()
Using `data()` better communicates the intent here. Also, depending on how `c_str()` is implemented, this fixes undefined behavior: The part of the string after the first NULL character might have undefined contents.
This commit is contained in:
parent
a25945318f
commit
f3b51eb935
6 changed files with 8 additions and 8 deletions
|
|
@ -366,7 +366,7 @@ static UniValue CallRPC(BaseRequestHandler *rh, const std::string& strMethod, co
|
|||
std::string endpoint = "/";
|
||||
if (!gArgs.GetArgs("-rpcwallet").empty()) {
|
||||
std::string walletName = gArgs.GetArg("-rpcwallet", "");
|
||||
char *encodedURI = evhttp_uriencode(walletName.c_str(), walletName.size(), false);
|
||||
char *encodedURI = evhttp_uriencode(walletName.data(), walletName.size(), false);
|
||||
if (encodedURI) {
|
||||
endpoint = "/wallet/"+ std::string(encodedURI);
|
||||
free(encodedURI);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue