Skip to content

Commit

Permalink
Fix infinite loop when initializing trimmed LUKS header.
Browse files Browse the repository at this point in the history
The luksHeaderBackup stores only real used LUKS metadata, so
reading of such a header can return EOF.
  • Loading branch information
mbroz authored and Nathaniel McCallum committed Apr 10, 2018
1 parent 278d01d commit 2c0d7a1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libluksmeta.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ readall(int fd, void *data, size_t size)
r = read(fd, &tmp[t], size - t);
if (r < 0 && errno != EAGAIN)
return -errno;
if (r == 0)
return -ENOENT;
}

return size;
Expand Down

0 comments on commit 2c0d7a1

Please sign in to comment.