Fix key_macing_length() return value when nbytes is 0.

This commit is contained in:
Romain Tartiere 2010-12-17 22:53:40 +00:00
parent 5b55528008
commit c9680fd7c7
2 changed files with 20 additions and 1 deletions

View file

@ -236,7 +236,7 @@ key_macing_length (const MifareDESFireKey key)
size_t
padded_data_length (const size_t nbytes, const size_t block_size)
{
if (nbytes % block_size)
if ((!nbytes) || (nbytes % block_size))
return ((nbytes / block_size) + 1) * block_size;
else
return nbytes;