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

Bug fix on IncorrectContentLength.bambda #42

Merged

Conversation

BugBountyzip
Copy link
Contributor

image

An exception was thrown while running your Bambda for item number 2

java.lang.NumberFormatException: Cannot parse null string
	at java.base/java.lang.Integer.parseInt(Integer.java:627)
	at java.base/java.lang.Integer.parseInt(Integer.java:781)

The original script faced an issue where it attempted to parse the Content-Length header value as an integer without checking if the header was actually present. This led to a NumberFormatException when the header was missing, as it tried to parse a null string.

To fix this, I added a check to ensure that the Content-Length header exists before parsing it. If the header is missing, the script skips the parsing step, thereby avoiding the NumberFormatException. Additionally, I included a try-catch block to gracefully handle any potential number format exceptions that might occur if the header value is not a valid integer. This made the script more robust and error-resistant.

Bambda Contributions

  • Bambda has a valid header, featuring an @author annotation and suitable description
  • Bambda compiles and executes as expected
  • Only .bambda files have been added or modified (README.md files are automatically updated / generated after PR merge)

BugBountyzip and others added 2 commits December 13, 2023 17:18
The original script faced an issue where it attempted to parse the `Content-Length` header value as an integer without checking if the header was actually present. This led to a `NumberFormatException` when the header was missing, as it tried to parse a `null` string.

To fix this, I added a check to ensure that the `Content-Length` header exists before parsing it. If the header is missing, the script skips the parsing step, thereby avoiding the `NumberFormatException`. Additionally, I included a `try-catch` block to gracefully handle any potential number format exceptions that might occur if the header value is not a valid integer. This made the script more robust and error-resistant.
Copy link
Collaborator

@PortSwiggerWiener PortSwiggerWiener left a comment

Choose a reason for hiding this comment

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

Thanks for the bug fix! We've kept the exception throwing if the NumberFormatException is thrown as this is potentially interesting.

Good job 👍

Copy link
Contributor

@ps-porpoise ps-porpoise left a comment

Choose a reason for hiding this comment

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

👍

@ps-porpoise ps-porpoise merged commit 4124d9a into PortSwigger:main Dec 13, 2023
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants