summaryrefslogtreecommitdiff
blob: 0c27095fff16b458180885648b321b4616766a08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Index: encfs/base64.cpp
===================================================================
--- encfs/base64.cpp	(revision 68)
+++ encfs/base64.cpp	(revision 69)
@@ -80,7 +80,7 @@
     }
 
     // we have at least one value that can be output
-    char outVal = work & mask;
+    unsigned char outVal = work & mask;
     work >>= dst2Pow;
     workBits -= dst2Pow;
 
@@ -96,8 +96,15 @@
 	*outLoc++ = outVal;
 
 	// we could have a partial value left in the work buffer..
-	if(workBits && outputPartialLastByte)
-	    *outLoc = work & mask;
+        if(outputPartialLastByte)
+        {
+            while(workBits > 0)
+            {
+                *outLoc++ = work & mask;
+                work >>= dst2Pow;
+                workBits -= dst2Pow;
+            }
+        }
     }
 }