hexdecoct: add missing NULL check

Fixes oss-fuzz#54065 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54065).

Fixes #25650.
This commit is contained in:
Yu Watanabe 2022-12-07 06:58:23 +09:00
parent 6b0df52e58
commit 45655e776f
2 changed files with 1 additions and 1 deletions

View file

@ -606,7 +606,7 @@ ssize_t base64mem_full(
if (!r)
return -ENOMEM;
for (x = p; x < (const uint8_t*) p + (l / 3) * 3; x += 3) {
for (x = p; x && x < (const uint8_t*) p + (l / 3) * 3; x += 3) {
/* x[0] == XXXXXXXX; x[1] == YYYYYYYY; x[2] == ZZZZZZZZ */
maybe_line_break(&z, r, line_break);
*(z++) = base64char(x[0] >> 2); /* 00XXXXXX */

Binary file not shown.