Skip to content

Commit

Permalink
Prevent memory corruption during ACLK OTP decode (netdata#18863)
Browse files Browse the repository at this point in the history
Allocate large enough buffer to prevent buffer overrun
  • Loading branch information
stelfrag authored Oct 24, 2024
1 parent 4353dd7 commit dcdd994
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/aclk/aclk_otp.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ int aclk_get_otp_challenge(url_t *target, const char *agent_id, unsigned char **
goto cleanup_json;
}

*challenge = mallocz(CHALLENGE_LEN);
*challenge = mallocz((CHALLENGE_LEN_BASE64 / 4) * 3 + 1);
*challenge_bytes = netdata_base64_decode(*challenge, (const unsigned char *) challenge_base64, CHALLENGE_LEN_BASE64);

if (*challenge_bytes != CHALLENGE_LEN) {
Expand Down

0 comments on commit dcdd994

Please sign in to comment.