Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix packet padding concatenation error (#1819) #1851

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

alexisbalbachan
Copy link
Contributor

  • This happens when trying to parse packets headers from raw data, if the available data is less than the expected header length the library will try to pad zeroes to it:

    if(len(aBuffer) < hdr_len): #we must do something like this
    diff = hdr_len - len(aBuffer)
    for i in range(0, diff):
    aBuffer += '\x00'

  • The padding worked fine in python 2, the buffer and '\x00' are considered bytes.

  • In python 3 '\x00' is considered a string so we get an error when trying to append it to a bytes buffer: TypeError: can't concat str to bytes

Affected classes so far are:

  1. IP6
  2. ICMP6
  3. LINUXSLL
  4. UDP
  5. ARP
  6. ICMP
  7. IGMP

@alexisbalbachan
Copy link
Contributor Author

Fixes #1819

@anadrianmanrique anadrianmanrique self-requested a review November 22, 2024 14:32
@anadrianmanrique anadrianmanrique added the bug Unexpected problem or unintended behavior label Nov 22, 2024
@anadrianmanrique
Copy link
Contributor

Thanks for the PR. Merging..

@anadrianmanrique anadrianmanrique merged commit af51dfd into fortra:master Nov 27, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants