Menu

#284 Parsing Unsigned Values from Config XML

2.0.3.0
closed
None
2020-08-21
2019-10-11
No

The following lines in file trdp_xml.c for the function trdp_XMLGetAttribute() function are effectively reading the values as signed integer and not unsigned integer. All the values (except offset) are to be treated as unsigned.

vos_strncpy(value, pXML->tokenValue, MAX_TOK_LEN - 1u);
*pValueInt  = (UINT32) strtol(value, NULL, 10);  /* atoi(value); */

On keeping value 4294967295 (0xFFFFFFFF) in XML, the value read is 2147483647 (0x7FFFFFFF). Maybe we should use strtoul() instead of strtol().

Discussion

  • Bernd Löhr

    Bernd Löhr - 2019-10-23
    • Milestone: 2.0.2.0 --> 2.1.0.0
     
  • Bernd Löhr

    Bernd Löhr - 2019-10-23

    If using strtoul we could not read signed values anymore :-(
    The parser has to be extended to handle both types. Postponed to the next release...

     
  • Bernd Löhr

    Bernd Löhr - 2020-01-08
    • status: open --> accepted
    • assigned_to: Bernd Löhr
     
  • Bernd Löhr

    Bernd Löhr - 2020-03-27
    • Milestone: 2.1.0.0 --> 2.0.3.0
     
  • Bernd Löhr

    Bernd Löhr - 2020-03-27
    • status: accepted --> pending
     
  • Bernd Löhr

    Bernd Löhr - 2020-03-27

    Changed trdp_XMLGetAttribute to parse unsigned int, and in tlc_xml.c the offset is read using strtol.

     
  • Bernd Löhr

    Bernd Löhr - 2020-08-21
    • Status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB