Skip to content

🐛 Bug: nil pointer dereference when using RemoteAddr on disconnect handler #382

@si3nloong

Description

@si3nloong

📜 Description

I have a log service to track the connection offline and we need to retrieve the IP from remote addr, but it return nil because the connection had closed, the connection will be always nil, so this will result in invalid memory address or nil pointer dereference
Image

I have a PR to fix this specific issue.

👟 Reproduction steps

  1. Charger disconnect from the central system
  2. Trigger disconnect handler
  3. Use RemoteAddr, it throw invalid memory address or nil pointer dereference

👍 Expected behavior

The server shouldn't panic

👎 Actual Behavior

Image The server throw `invalid memory address or nil pointer dereference` and panic

What OCPP version are you using?

  • OCPP 1.6
  • OCPP 2.0.1

Are you using any OCPP extensions?

  • OCPP 1.6 Security
  • OCPP 1.6 Plug and Charge

release version

v0.19.1-0.20250817142028-b22429c28ebb

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been found before?

  • I checked and didn't find a similar issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions