Skip to content

Commit 32c5bcb

Browse files
authored
Merge pull request #614 from RUB-NDS/printLastFix
Fixed last handled application data action context/chooser confusion
2 parents 400459f + 8a55d04 commit 32c5bcb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/workflow/action/PrintLastHandledApplicationDataAction.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,17 @@ public PrintLastHandledApplicationDataAction(String connectionAlias) {
5151

5252
@Override
5353
public void execute(State state) throws WorkflowExecutionException {
54-
byte[] rawBytes = state.getTlsContext(getConnectionAlias()).getChooser().getLastHandledApplicationMessageData();
55-
if (stringEncoding != null) {
56-
lastHandledApplicationData = new String(rawBytes, Charset.forName(stringEncoding));
54+
byte[] rawBytes = state.getTlsContext(getConnectionAlias()).getLastHandledApplicationMessageData();
55+
if (rawBytes != null) {
56+
if (stringEncoding != null) {
57+
lastHandledApplicationData = new String(rawBytes, Charset.forName(stringEncoding));
58+
} else {
59+
lastHandledApplicationData = ArrayConverter.bytesToHexString(rawBytes);
60+
}
61+
CONSOLE.info("Last handled application data: " + lastHandledApplicationData);
5762
} else {
58-
lastHandledApplicationData = ArrayConverter.bytesToHexString(rawBytes);
63+
CONSOLE.info("Did not receive application data yet");
5964
}
60-
CONSOLE.info("Last handled application data: " + lastHandledApplicationData);
6165
setExecuted(true);
6266
}
6367

0 commit comments

Comments
 (0)