You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2024/08/14 10:30:48 UTC

(directory-server) branch master updated: Fix for DIRSERVER-2409

This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git


The following commit(s) were added to refs/heads/master by this push:
     new cc42231912 Fix for DIRSERVER-2409
cc42231912 is described below

commit cc42231912189ba9e7b352a9b5e870df00793ce9
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Wed Aug 14 12:30:45 2024 +0200

    Fix for DIRSERVER-2409
---
 .../server/core/partition/impl/btree/jdbm/StringSerializer.java    | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializer.java b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializer.java
index 67853b17e3..252142734b 100644
--- a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializer.java
+++ b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializer.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 import jdbm.helper.Serializer;
 
 import org.apache.directory.api.util.Strings;
+import org.apache.directory.server.i18n.I18n;
 
 
 /**
@@ -57,6 +58,12 @@ public final class StringSerializer implements Serializer
         {
             return "";
         }
+        
+        // Check that we don't have a odd number of bytes (we should have an even number of bytes)
+        if ( ( bytes.length & 1 ) == 1 )
+        {
+            throw new IOException( I18n.err( I18n.ERR_31001_ODD_NUMBER_OF_BYTES_IN_SERIALIZED_STRING ) );
+        }
 
         char[] strchars = new char[bytes.length >> 1];
         int pos = 0;