xauth-pam: Sanitize XAuth attributes before passing them to PAM

This commit is contained in:
Martin Willi 2014-01-22 14:01:01 +01:00
parent 5770e28e96
commit 7dc8bf495b
1 changed files with 5 additions and 1 deletions

View File

@ -116,7 +116,11 @@ static void attr2string(char *buf, size_t len, chunk_t chunk)
{
if (chunk.len && chunk.len < len)
{
snprintf(buf, len, "%.*s", (int)chunk.len, chunk.ptr);
chunk_t sane;
chunk_printable(chunk, &sane, '?');
snprintf(buf, len, "%.*s", (int)sane.len, sane.ptr);
chunk_clear(&sane);
}
}