xauth-pam: Add workaround for null-terminated passwords

Fixes #631.
This commit is contained in:
Tobias Brunner 2014-07-07 11:12:30 +02:00
parent 839951097c
commit 44870e5313

View File

@ -153,7 +153,12 @@ METHOD(xauth_method_t, process, status_t,
attr2string(user, sizeof(user), chunk);
break;
case XAUTH_USER_PASSWORD:
attr2string(pass, sizeof(pass), attr->get_chunk(attr));
chunk = attr->get_chunk(attr);
if (chunk.len && chunk.ptr[chunk.len - 1] == 0)
{ /* fix null-terminated passwords (Android etc.) */
chunk.len -= 1;
}
attr2string(pass, sizeof(pass), chunk);
break;
default:
break;