Skip to content

Fix sending when offset+ret larger than sock size #58

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

Merged
merged 1 commit into from
May 23, 2022
Merged

Fix sending when offset+ret larger than sock size #58

merged 1 commit into from
May 23, 2022

Conversation

rstein
Copy link
Contributor

@rstein rstein commented May 15, 2022

Hi!

I have noticed a bug in your library. It seems the code for writing data to the socket buffer was duplicated when support for the W5100s was introduced. Data is therefore written twice to the socket buffer.
This leads to mangled data whenever the current buffer offset + size of the data to send exceeds the total size of the socket buffer.

Example:
Current buffer offset is 2028.
Data to send is 50 bytes.
The first 20 bytes of our data fit into the socket buffer so they are written correctly. Afterwards the last 30 bytes of data are written to the beginning of the socket buffer, but are then again overwritten by the first 30 bytes of our data.

I have removed the duplicated writing of data in this PR.

@ladyada
Copy link
Member

ladyada commented May 15, 2022

i think this code came from @bjnhur - any thoughts?

@bjnhur
Copy link
Contributor

bjnhur commented May 20, 2022

I think, this duplication happens at the "mege upstream" - c24f9dc

Anyway, I agree the removal of the duplicated code.

@ladyada ladyada requested a review from brentru May 20, 2022 21:59
Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with @bjnhur - this is duplicated code introduced during a prv. PR and should be merged in to fix.

I do not have a W5100s to test this on, however.

@brentru brentru merged commit 737dad8 into adafruit:main May 23, 2022
@rstein rstein deleted the fix_sending_when_offset_greater_than_socksize branch May 23, 2022 15:12
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jun 1, 2022
Updating https://github.com/adafruit/Adafruit_CircuitPython_floppy to 1.0.2 from 1.0.1:
  > Set language to "en" for documentation
  > Merge pull request adafruit/Adafruit_CircuitPython_floppy#4 from tekktrik/dev/lint-example
  > Update .pre-commit-config.yaml
  > Fix Docs badge
  > fix discord link for RTD
  > fix python version for rtd

Updating https://github.com/adafruit/Adafruit_CircuitPython_HT16K33 to 4.3.1 from 4.3.0:
  > Set language to "en" for documentation
  > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#99 from makermelissa/master
  > Switch to inclusive terminology
  > Increase min lines similarity
  > Patch .pre-commit-config.yaml
  > change discord badge
  > Patch: Replaced discord badge image
  > Updated gitignore
  > Update Black to latest.
  > Fixed readthedocs build

Updating https://github.com/adafruit/Adafruit_CircuitPython_VL53L1X to 1.1.2 from 1.1.1:
  > Set language to "en" for documentation
  > Merge pull request adafruit/Adafruit_CircuitPython_VL53L1X#8 from caternuson/iss7_range_check
  > Increase min lines similarity
  > Patch .pre-commit-config.yaml

Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 1.12.6 from 1.12.5:
  > Set language to "en" for documentation
  > Switch to inclusive terminology
  > Increase min lines similarity
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#58 from rstein/fix_sending_when_offset_greater_than_socksize
  > Patch .pre-commit-config.yaml
  > change discord badge
  > Patch: Replaced discord badge image
  > Update .gitignore

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE to 8.3.2 from 8.3.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#167 from tekktrik/doc/hyperspecific-targets

Updating https://github.com/adafruit/Adafruit_CircuitPython_JWT to 1.2.7 from 1.2.6:
  > Set language to "en" for documentation
  > Merge pull request adafruit/Adafruit_CircuitPython_JWT#14 from Neradoc/add-deps
  > Switch to inclusive terminology
  > Increase min lines similarity
  > Patch .pre-commit-config.yaml

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_floppy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants