Skip to content

Commit

Permalink
yubikey: Just trim the existing buffer, don't allocate a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed May 24, 2020
1 parent 48d12d8 commit 2e817ed
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/modules/rlm_yubikey/rlm_yubikey.c
Expand Up @@ -301,8 +301,6 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, UNUSED void *t

/* May be a concatenation, check the last 32 bytes are modhex */
if (inst->split) {
char *remainder;

/*
* Insert a new request attribute just containing the OTP
* portion.
Expand All @@ -314,9 +312,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, UNUSED void *t
* Replace the existing string buffer for the password
* attribute with one just containing the password portion.
*/
MEM(remainder = talloc_array(password, char, password_len + 1));
strlcpy(remainder, passcode, password_len + 1);
fr_pair_value_strsteal(password, remainder);
MEM(fr_pair_value_bstr_realloc(password, NULL, password_len) == 0);

RINDENT();
if (RDEBUG_ENABLED3) {
Expand Down

0 comments on commit 2e817ed

Please sign in to comment.