From 94036bddb2030866574eefab8a0ad83dfe6a9a97 Mon Sep 17 00:00:00 2001 From: Felix Buschbeck Date: Mon, 3 Jun 2024 13:14:33 -0400 Subject: [PATCH] Fix null byte addition during variable lookup --- src/main/java/de/usd/cstchef/Utils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/usd/cstchef/Utils.java b/src/main/java/de/usd/cstchef/Utils.java index 1e99477..9686145 100644 --- a/src/main/java/de/usd/cstchef/Utils.java +++ b/src/main/java/de/usd/cstchef/Utils.java @@ -217,8 +217,11 @@ public static HttpRequest addCookieToHttpRequest(HttpRequest request, Cookie coo } public static ByteArray insertAtOffset(ByteArray input, int start, int end, ByteArray newValue) { - ByteArray prefix = BurpUtils.subArray(input, 0, start); - ByteArray rest = BurpUtils.subArray(input, end, input.length()); + ByteArray prefix = input.subArray(0, start); + ByteArray rest = input.subArray(0, 0); + if(end < input.length()) { + rest = input.subArray(end, input.length()); + } ByteArray output = prefix.withAppended(newValue).withAppended(rest); return output;