8000 getNodeIpList crashes · Issue #13 · qubic/qubic-cli · GitHub
[go: up one dir, main page]

Skip to content

getNodeIpList crashes #13

Open
Open

Description

@wilricknl

Hi, not sure what this line is trying to achieve, but it crashes my application when querying a node ip list.

memset(&result, 0, sizeof(CurrentTickInfo));

You can reproduce it with the following command:

qubic-cli.exe -nodeip "62.2.98.74" -getnodeiplist

Possible fix:

Simply removing the above line.

Activity

  1. wilricknl commented on Apr 3, 2024

    @wilricknl
    Author

    Another issue with printSystemInfoFromNode in this line:

    char hex[64];

    Issue:

    Crashes upon log, because hex is not null-terminated.

    Reproduction

    qubic-cli.exe -nodeip "62.2.98.74" -getsysteminfo

    Possible fix:

    char hex[65];
    hex[64] = '\0';

    At first I just wanted to just open an issue, because I didn't see a point in an MR for 1 line, but maybe I will make an MR if I run into more stuff.

  2. wilricknl commented on Apr 3, 2024

    @wilricknl
    Author

    Also a null-termination bug in parsing the seed from a config file.

    Line:

    g_seed = (char*) malloc(55);

    Possible fix:

    g_seed = (char*)malloc(56);
    memset(g_seed, 0, 56);
  3. added a commit that references this issue on May 7, 2024
  4. parthod0x commented on Oct 7, 2026

    @parthod0x
    Contributor

    Opened #133, which addresses the seed null-termination report here.

    Status of the three bugs raised in this thread, checked against current main:

    • seed null-termination (argparser.h): still present. The config path now
      does malloc(55); memset(0,55); memcpy(…,55), which fills all 55 bytes with
      no terminator, so sanityCheckSeed()'s strlen() reads past the allocation
      (confirmed under ASAN: READ of size 56). Also over-reads the source if the
      configured seed is shorter than 55 chars. Fixed in Fix buffer overflows when parsing seed and node_ip from a config file #133 (allocate 56, copy at
      most the value's length). While there I also bounded the adjacent node_ip
      copy, which could overflow its 64-byte buffer for a value longer than 64 chars.
    • printSystemInfoFromNode hex (was nodeUtils.cpp:103): already resolved —
      byteToHex null-terminates via snprintf and the buffer is now char hex[65].
    • getNodeIpList crash (was nodeUtils.cpp:1054): already resolved — the
      current peer loop in node_utils.cpp is bounded (for i < 4 over peers[4][4]).

    So only the seed/config-parse part remained; #133 covers it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0