Remove implicit handle of final \0 in ByteArray

This commit is contained in:
Grégory Soutadé 2021-09-28 14:58:41 +02:00
parent 47a38b1ebc
commit dc15fc7197
3 changed files with 4 additions and 4 deletions

View File

@ -293,7 +293,7 @@ namespace gourou
*/
static inline void writeFile(std::string path, ByteArray& data)
{
writeFile(path, data.data(), data.length()-1);
writeFile(path, data.data(), data.length());
}
/**

View File

@ -37,14 +37,14 @@ namespace gourou
ByteArray::ByteArray(const char* data, int length)
{
if (length == -1)
length = strlen(data) + 1;
length = strlen(data);
initData((const unsigned char*)data, (unsigned int) length);
}
ByteArray::ByteArray(const std::string& str)
{
initData((unsigned char*)str.c_str(), (unsigned int)str.length() + 1);
initData((unsigned char*)str.c_str(), (unsigned int)str.length());
}
void ByteArray::initData(const unsigned char* data, unsigned int length)

View File

@ -907,7 +907,7 @@ namespace gourou
ByteArray privateLicenseKey = ByteArray::fromBase64(user->getPrivateLicenseKey());
/* In adobekey.py, we get base64 decoded data [26:] */
write(fd, privateLicenseKey.data()+26, privateLicenseKey.length()-1-26);
write(fd, privateLicenseKey.data()+26, privateLicenseKey.length()-26);
close(fd);
}