Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CmdMess access voilation on Send #2

Closed
pmahend1 opened this issue Feb 4, 2019 · 4 comments
Closed

CmdMess access voilation on Send #2

pmahend1 opened this issue Feb 4, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@pmahend1
Copy link

pmahend1 commented Feb 4, 2019

When I run the CMDMess on 2 different machines I am able to connect the two machines. But when I do send UUID_of_remote "hello" it throws exception Exception thrown at 0x528E175F (ucrtbased.dll) in CmdMess.exe: 0xC0000005: Access violation reading location 0x00000001.

Is it due to auto m_Extender = std::make_shared<TestExtender::Extender>(nullptr); being nullptr

I have all the libraries working well. This is we try to run in Debug/Release 32 mode and I have changed UUID at line params.UUID.Set of one machine so that two of them dont have same UUID

@kareldonk
Copy link
Owner

kareldonk commented Feb 4, 2019

In CmdMess you should use the LUID (Locally Unique Identifier) to send a message. When the peer connects you will see the LUID in the console. You also need to specify the number of times to send at the end. So the command is send LUID "hello" 10, which would send hello ten times.
Note that CmdMess is a small and very simple test program to quickly test some features so it's not very polished and doesn't do rigorous checks of inputs. I'll see if I can repro the crash.

kareldonk added a commit that referenced this issue Feb 5, 2019
@kareldonk
Copy link
Owner

kareldonk commented Feb 5, 2019

I was able to repro the issue; it was an issue that would occur in the 32-bit version of CmdMess due to an incorrect formatting option. You can see the changes in commit 5798e29. The peer LUID is a 64-bit number and requires the %llu option instead of %u.

You can apply those two small changes yourself or sync with master branch to get the latest updates. Thanks for reporting.

Do keep in mind that the way CmdMess is written, it requires the peer LUID when using the send command. The reason for that is that peers can basically use the same UUID (Universally Unique Identifier) to connect to the local instance. For example, there are no limits that would prevent 2 other peers to use the same UUID to connect to you, or, for one peer to have two simultaneous connections to you. To distinguish between those two (or more) connections using the same UUID, QuantumGate automatically assigns every connection a LUID (Locally Unique Identifier). This LUID will always be different whenever the program is executed, even if the UUID is the same. So don't rely on having the same LUID each time for the same peer.

Because there are no limits for a peer to use the same UUID as another peer, or to try to spoof another peer by using the same UUID, you should only rely on the UUID if authentication is enabled. That way it's impossible for someone to spoof another peer with the same UUID unless they also have the private (secret) key associated with that UUID. If they try to use someone else's UUID and don't have the private key, authentication will fail and the connection will not be accepted (if QuantumGate is configured to require authentication).

There are ways for an app or extender that you write to check if a connection to a peer is authenticated. For example, the GetPeerDetails function returns that information and more.

@pmahend1
Copy link
Author

pmahend1 commented Feb 5, 2019

I made these small changes and it works fine and thanks for the fix and clear explanation of the platform .

@kareldonk
Copy link
Owner

You're welcome. :)

@kareldonk kareldonk added the bug Something isn't working label Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants