Skip to content

Commit

Permalink
[spotify] Allow for longer tokens (fixes #1846)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejurgensen committed Feb 4, 2025
1 parent 358e792 commit 4b5b30a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/inputs/librespot-c/librespot-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ struct sp_credentials
char username[64];
char password[32];

uint8_t stored_cred[256]; // Actual size is 146, but leave room for some more
uint8_t stored_cred[512]; // Actual size is 146, but leave room for some more
size_t stored_cred_len;
uint8_t token[256]; // Actual size is ?
uint8_t token[512]; // Actual size is 270 for family accounts
size_t token_len;
};

Expand Down
4 changes: 2 additions & 2 deletions src/inputs/librespot-c/src/librespot-c.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ session_new(struct sp_session **out, struct sp_cmdargs *cmdargs, event_callback_
if (cmdargs->stored_cred)
{
if (cmdargs->stored_cred_len > sizeof(session->credentials.stored_cred))
RETURN_ERROR(SP_ERR_INVALID, "Invalid stored credential");
RETURN_ERROR(SP_ERR_INVALID, "Stored credentials too long");

session->credentials.stored_cred_len = cmdargs->stored_cred_len;
memcpy(session->credentials.stored_cred, cmdargs->stored_cred, session->credentials.stored_cred_len);
}
else if (cmdargs->token)
{
if (strlen(cmdargs->token) > sizeof(session->credentials.token))
RETURN_ERROR(SP_ERR_INVALID, "Invalid token");
RETURN_ERROR(SP_ERR_INVALID, "Token too long");

session->credentials.token_len = strlen(cmdargs->token);
memcpy(session->credentials.token, cmdargs->token, session->credentials.token_len);
Expand Down

0 comments on commit 4b5b30a

Please sign in to comment.