Commit 2cbb6f31 authored by David Fuhrmann's avatar David Fuhrmann

keychain: Pad user name if its read out from keychain

Tests show that the username actually still needs to be padded.
Otherwise, crashes can occur in subsequent usage of username, as
it might contain garbage.
parent eb44067d
......@@ -399,7 +399,10 @@ static unsigned int Find(vlc_keystore *p_keystore,
case kSecAccountItemAttr:
if (!p_entry->ppsz_values[KEY_USER]) {
msg_Dbg(p_keystore, "using account name from the keychain for login");
p_entry->ppsz_values[KEY_USER] = strdup((const char *)attr->data);
char *paddedName = calloc(1, attr->length + 1);
memcpy(paddedName, attr->data, attr->length);
p_entry->ppsz_values[KEY_USER] = paddedName;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment