Menu

#23 Uninitialized data in main_example.c

1.0
open
nobody
None
2024-02-06
2024-02-01
Gravis
No

The variable paymentDetailsRes is declared in function charging1and used but never initialized.

This is especially problematic because it's zero length value is assigned to exiIn.V2G_Message.Body.AuthorizationReq.GenChallenge.bytesLen which (unless I'm misinterpreting it) must be 16 per the specification.

    <xs:simpleType name="genChallengeType">
        <xs:restriction base="xs:base64Binary">
            <xs:length value="16"/>
        </xs:restriction>
    </xs:simpleType>

Discussion

  • Daniel Peintner

    Daniel Peintner - 2024-02-06

    Your statements are correct. The struct is not properly initialized.

    Having said that, the code you are referring to is from the "test" folder which is meant to provide a simple overview and examples how to use the code...
    As such main_example.c illustrates both sides EV and charging side. This is NO code you should/can ever use in production!
    Anyhow, it should be fixed. Thanks for reporting.

     
    • Gravis

      Gravis - 2024-02-06

      Yes, it's in src/test/main_example.c. Not to worry though because I'm not using it for production purposes, I'm merely debugging my own dynamic EXI encoder by comparing outputs. Comparing the I/O for the example code seemed like a nice starting point and thusly I'm running into bugs in the example code.

       

Log in to post a comment.