Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Crash DLMSClient On Wrong High Password

Crash DLMSClient on wrong high password

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

Profile picture for user Dmitry
By Dmitry , 4 March, 2022
Forums
Gurux.DLMS

Hi Mikko!

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"

Thanks!

Profile picture for user Dmitry

Dmitry

4 years ago

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!

Profile picture for user Kurumi

Kurumi

4 years ago

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

Profile picture for user Dmitry

Dmitry

4 years ago

This is meter firmware

This is meter firmware feature (not good). But method CGXByteBuffer::Compare() can be used elsewhere in the project.

Profile picture for user Kurumi

Kurumi

4 years ago

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

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin