Skip to content

Commit

Permalink
Catch IllegalArgumentException in request panel
Browse files Browse the repository at this point in the history
If CSTC is used with non HTTP messages, it throws exceptions that are
caused by the ``analyzeRequest`` function of Burp. These exceptions are
now catched.

Notice: The presence of these exceptions did not cause any errors and
they were only visible when Burp was started using the command line.
  • Loading branch information
qtc-de committed Apr 22, 2020
1 parent 632c9e2 commit e36652a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/de/usd/cstchef/view/RecipePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,20 @@ private byte[] doBake(byte[] input) {
if (BurpUtils.inBurp()) {
IBurpExtenderCallbacks callbacks = BurpUtils.getInstance().getCallbacks();
IExtensionHelpers helpers = callbacks.getHelpers();

IRequestInfo info = helpers.analyzeRequest(result);

IRequestInfo info;
try {
info = helpers.analyzeRequest(result);
} catch( IllegalArgumentException e ) {
// In this case there is no valid HTTP request and no Content-Length update is requried.
return result;
}

List<java.lang.String> headers = info.getHeaders();
int offset = info.getBodyOffset();

if( result.length == offset ) {
// In this case there is no body and we do not need to update the content length header
// In this case there is no body and we do not need to update the content length header.
return result;
}

Expand Down

0 comments on commit e36652a

Please sign in to comment.