PHP Classes

Multiline base64 encoded entries

Recommend this page to a friend!

      LDIF 2 Array  >  All threads  >  Multiline base64 encoded entries  >  (Un) Subscribe thread alerts  
Subject:Multiline base64 encoded entries
Summary:Multiline base64 encoded entries might be decoded wrong
Messages:1
Author:Henrik Carlqvist
Date:2019-10-16 19:02:38
 

  1. Multiline base64 encoded entries   Reply   Report abuse  
Picture of Henrik Carlqvist Henrik Carlqvist - 2019-10-16 19:02:38
I have found examples with multiline base64 encoded entries (jpegPhoto) which gets decoded wrong. The problem is that each line is decoded and then the decoded data is concatenated. The positions of the line breaks might cause each line to lose some data. The fix is to first concatenate all encoded data and then decode the concatenated data. The following patch helps against the problem:

--- ldif2array_old/ldif2array.class.php 2009-07-15 20:33:07.000000000 +0200
+++ ldif2array_new/ldif2array.class.php 2019-10-16 20:56:21.281634646 +0200
@@ -107,6 +107,10 @@
++$i;
$j=0;
} else {
+ /* handle multiline entries */
+ if((strpos($v, " ")==0) && ($j > 0))
+ $arr2[$i][$j-1].=substr($v, 1);
+ else /* not multiline or new line */
$arr2[$i][$j++]=$v;
}
}


regards Henrik

 
For more information send a message to info at phpclasses dot org.