bin2hex(): abort(3) if the length doesn't include the final \0

This commit is contained in:
Frank Denis 2015-05-15 09:23:59 +02:00
parent bf920dc717
commit 94255bee36

View File

@ -102,7 +102,7 @@ sodium_bin2hex(char * const hex, const size_t hex_maxlen,
int b;
int c;
if (bin_len >= SIZE_MAX / 2 || hex_maxlen < bin_len * 2U) {
if (bin_len >= SIZE_MAX / 2 || hex_maxlen <= bin_len * 2U) {
abort(); /* LCOV_EXCL_LINE */
}
while (i < bin_len) {