mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Fix bug with empty data object in xml plist
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10592 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b680f3e314
commit
71b8835828
3 changed files with 21 additions and 5 deletions
|
@ -143,11 +143,17 @@ encodeBase64(NSData *source)
|
|||
int enclen = length / 3;
|
||||
int remlen = length - 3 * enclen;
|
||||
int destlen = 4 * ((length - 1) / 3) + 5;
|
||||
unsigned char *sBuf = (unsigned char*)[source bytes];
|
||||
unsigned char *dBuf = NSZoneMalloc(NSDefaultMallocZone(), destlen);
|
||||
unsigned char *sBuf;
|
||||
unsigned char *dBuf;
|
||||
int sIndex = 0;
|
||||
int dIndex = 0;
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
sBuf = (unsigned char*)[source bytes];
|
||||
dBuf = NSZoneMalloc(NSDefaultMallocZone(), destlen);
|
||||
dBuf[destlen - 1] = '\0';
|
||||
|
||||
for (sIndex = 0; sIndex < length - 2; sIndex += 3, dIndex += 4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue