Skip to content

Incorrect decoding #2

Description

@ac169
  1. The following data will fail to decode and return empty, Lines ”0x31, 0x3a, 0x79, 0x31, 0x3a, 0x72, 0x31, 0x3a, 0x76, 0x34, 0x3a, 0x4c, 0x54, 0x01, 0x02“ can be decoded correctly when the first 6 characters are deleted or changed to the end of the line
 unsigned char msg[] = {
            0x64, 0x32, 0x3a, 0x69, 0x70, 0x36, 0x3a, 0x01, 0x17, 0x03, 0x6e, 0x71, 0xcb, 0x31, 0x3a, 0x72,
            0x64, 0x32, 0x3a, 0x69, 0x64, 0x32, 0x30, 0x3a, 0x1c, 0x11, 0xe0, 0x1b, 0xe8, 0xe7, 0x8d, 0x76,
            0x5a, 0x2e, 0x63, 0x33, 0x9f, 0xc9, 0x9a, 0x66, 0x32, 0x0d, 0xb7, 0x54, 0x65, 0x31, 0x3a, 0x74,
            0x38, 0x3a, 0x70, 0x6e, 0x5f, 0x42, 0x49, 0x36, 0x44, 0x53,
            0x31, 0x3a, 0x79, 0x31, 0x3a, 0x72, 0x31, 0x3a, 0x76, 0x34, 0x3a, 0x4c, 0x54, 0x01, 0x02,
            0x65, 0x00
    };

 struct bencode *b = (struct bencode *) ben_decode(msg, strlen(msg));
  1. isprint() function does not work properly under windows.

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