Skip to content

Fix for truncation/corruption on long json responses in webconfig#1618

Open
mattaaron79 wants to merge 1 commit intoOpenStickCommunity:mainfrom
mattaaron79:fix-file-response-truncation
Open

Fix for truncation/corruption on long json responses in webconfig#1618
mattaaron79 wants to merge 1 commit intoOpenStickCommunity:mainfrom
mattaaron79:fix-file-response-truncation

Conversation

@mattaaron79
Copy link
Copy Markdown
Contributor

Description

Fixed truncated/corrupted json responses. In webconfig.cpp set_file_data() had a line which set the file index to its length. I think this was accidentally working, but with long json responses was causing responses to get truncated (I was observing a single character getting cut off the json response, the closing bracket). It's possible the index was wrapping around back around via a modulus operation somewhere, but set to 1 instead of 0. Looking at the dependency, the index should indicate how much of the file has been sent out so far, which I believe should always start at zero, as we are initializing the response here.

Proposed Changes

  • file->index = 0

Type of Change

  • [X ] Bug fix
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing Instructions

Testing is difficult here in the main branch, as our json responses aren't usually long enough to trigger the original bug, but I and other developers have noticed the bug with features that return longer responses (Pod, for example).

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.

1 participant