Skip to content

Commit

Permalink
incusd/instance/lxc: Fix off by one idmap check
Browse files Browse the repository at this point in the history
Closes #1294

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
  • Loading branch information
stgraber committed Oct 21, 2024
1 parent 9561e90 commit c3dcb98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/server/instance/drivers/driver_lxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ func (d *lxc) findIdmap() (*idmap.Set, int64, error) {
offset = mapentries.Entries[i].HostID + mapentries.Entries[i].MapRange
}

if offset+size < d.state.OS.IdmapSet.Entries[0].HostID+d.state.OS.IdmapSet.Entries[0].MapRange {
if offset+size <= d.state.OS.IdmapSet.Entries[0].HostID+d.state.OS.IdmapSet.Entries[0].MapRange {
set, err := mkIdmap(offset, size)
if err != nil && err == idmap.ErrHostIDIsSubID {
return nil, 0, err
Expand Down

0 comments on commit c3dcb98

Please sign in to comment.