I try connect to meter with wrong password (on correct password - OK).
Crash in CGXDLMSClient::ParseApplicationAssociationResponse(), in row: equals = challenge.Compare(value.byteArr, value.GetSize());
My code:
constexpr int server_addr_logical = 1;
constexpr int phisycal_addr = 0;
auto serverAddress = CGXDLMSClient::GetServerAddress(server_addr_logical, phisycal_addr, 4);
const std::string password_high_wrong("qwerty");
meter_client = std::make_unique<CGXDLMSSecureClient>(true, 0x30, serverAddress, DLMS_AUTHENTICATION::DLMS_AUTHENTICATION_HIGH, password_high_wrong.c_str(), DLMS_INTERFACE_TYPE::DLMS_INTERFACE_TYPE_HDLC);
After sending
std::vector<CGXByteBuffer> data;
int ret = meter_client->GetApplicationAssociationRequest(data)
i'm parsing this:
int ret1 = meter_client->ParseApplicationAssociationResponse(reply.GetData();
Exchange:
SNRMRequest()
Send to meter: "7ea00a000200016193fd817e"
recieved from serial "7ea023610002000173a4d78180140502008006020080070400000001080400000001ce6a7e"
AARQRequest()
Send to meter: "7ea04f000200016110cb00e6e600603ea1090607608574050801018a0207808b0760857405080202ac12801067c6697351ff4aec29cdbaabf2fbe346be10040e01000000065f1f0400001e5dffff13517e"
recieved from serial "7ea05b6100020001309b68e6e700614aa109060760857405080101a203020100a305a10302010e88020780890760857405080202aa128010a90ca9754a17c47186f2a970467719e6be10040e0800065f1f0400001e1d10000007d8f37e"
Authentication()
Send to meter: "7ea02e0002000161328b39e6e600c30181000f0000280000ff01010910732d4cfc705ff7cb141013061c65dc12aa297e"
recieved from serial "7ea017610002000152135ee6e700c70181000100030057867e"
Hi, Mikko!
On wrong high password my meter return c701810001000300 03 - Bool type, 00 - false value.
CGXDLMSVariant value.byteArr == nullptr.
Row equals = challenge.Compare(value.byteArr, value.GetSize()); try compare challenge with nullptr.
I think to the bool CGXByteBuffer method::Compare() need to add a check of the *buff pointer to nullptr and return false if buff==nullptr.
If the high level password is invalid the meters are returning usually error code or some meters are returning an empty octect string, but DLMS standard says that the returned value is Client to Server that is octet-string. You should not return an boolean value.
I think that you are right with CGXByteBuffer::Compare method. I was too focused on a meter reply. The method should check the NULL pointer. This check is added at the beginning of the method.
if (buff == NULL || length == 0)
{
return m_Size == 0;
}
It'll take some time to run all the tests before it's released.
Hi, Mikko!
Hi, Mikko!
On wrong high password my meter return c701810001000300 03 - Bool type, 00 - false value.
CGXDLMSVariant value.byteArr == nullptr.
Row equals = challenge.Compare(value.byteArr, value.GetSize()); try compare challenge with nullptr.
I think to the bool CGXByteBuffer method::Compare() need to add a check of the *buff pointer to nullptr and return false if buff==nullptr.
Thanks!
Hi,
Hi,
If the high level password is invalid the meters are returning usually error code or some meters are returning an empty octect string, but DLMS standard says that the returned value is Client to Server that is octet-string. You should not return an boolean value.
BR,
Mikko
This is meter firmware
This is meter firmware feature (not good). But method CGXByteBuffer::Compare() can be used elsewhere in the project.
Hi,
Hi,
I think that you are right with CGXByteBuffer::Compare method. I was too focused on a meter reply. The method should check the NULL pointer. This check is added at the beginning of the method.
if (buff == NULL || length == 0)
{
return m_Size == 0;
}
It'll take some time to run all the tests before it's released.
BR,
Mikko