shared/ask-password-api: modify keyctl break value

We can break if KEYCTL_READ return value is equal to our buffer size.

From keyctl(2):

On a successful return, the return value is always the total size of
the payload data.  To determine whether the buffer was of sufficient
size, check to see that the return value is less than or equal to the
value supplied in arg4.
This commit is contained in:
Kevin Kuehler 2019-11-27 16:35:15 -08:00 committed by Zbigniew Jędrzejewski-Szmek
parent a434236acc
commit 6da498c28f
1 changed files with 1 additions and 1 deletions

View File

@ -78,7 +78,7 @@ static int retrieve_key(key_serial_t serial, char ***ret) {
n = keyctl(KEYCTL_READ, (unsigned long) serial, (unsigned long) p, (unsigned long) m, 0);
if (n < 0)
return -errno;
if ((size_t) n < m) {
if ((size_t) n <= m) {
nfinal = (size_t) n;
pfinal = TAKE_PTR(p);
break;