From 46b1e2739a2faa1f5bf72c6f12f2e1223525ad43 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 21 May 2024 17:01:49 +0200 Subject: [PATCH] Avoid StringIndexOutOfBoundsException in KafkaRuntimeConfigProducer Fixes #40677 --- .../kafka/client/runtime/KafkaRuntimeConfigProducer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java index 504bc66168f4e..ba0f407ea5dec 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java @@ -35,6 +35,9 @@ public Map createKafkaRuntimeConfig(Config config, ApplicationCo if (!propertyNameLowerCase.startsWith(CONFIG_PREFIX) || propertyNameLowerCase.startsWith(UI_CONFIG_PREFIX)) { continue; } + if (propertyNameLowerCase.length() <= CONFIG_PREFIX.length()) { + continue; + } // Replace _ by . - This is because Kafka properties tend to use . and env variables use _ for every special // character. So, replace _ with . String effectivePropertyName = propertyNameLowerCase.substring(CONFIG_PREFIX.length() + 1).toLowerCase()