[lxc-devel] [lxc/lxc] 8737e2: lseek - integer overflow
GitHub
noreply at github.com
Sat Aug 18 16:05:20 UTC 2018
Branch: refs/heads/master
Home: https://github.com/lxc/lxc
Commit: 8737e2a8a56f2dc4c8f35ccc413d59b5c78c3a30
https://github.com/lxc/lxc/commit/8737e2a8a56f2dc4c8f35ccc413d59b5c78c3a30
Author: Lukasz Jagiello <lukasz at wikia-inc.com>
Date: 2018-08-18 (Sat, 18 Aug 2018)
Changed paths:
M src/lxc/storage/loop.c
Log Message:
-----------
lseek - integer overflow
The issue was introduced in PR (https://github.com/lxc/lxc/pull/1705):
Previous code:
```
if (lseek(fd, size, SEEK_SET) < 0) {
SYSERROR("Error seeking to set new loop file size");
close(fd);
return -1;
}
```
New code:
```
int fd, ret;
[...]
ret = lseek(fd, size, SEEK_SET);
if (ret < 0) {
SYSERROR("Failed to seek to set new loop file size for loop "
"file \"%s\"", path);
close(fd);
return -1;
}
```
Based on http://man7.org/linux/man-pages/man2/lseek.2.html:
> Upon successful completion, lseek() returns the resulting offset
> location as measured in bytes from the beginning of the file.
So in this case value of `size` and `size` is `uint64_t`.
This fix change declaration of `ret`, but it can be fixed in other ways.
Let me know what works for you.
This PR fix issues (https://github.com/lxc/lxc/issues/1872).
Signed-off-by: Lukasz Jagiello <lukasz at wikia-inc.com>
Commit: 0a4f0d02d83c26f1ac8b637b7ca11546ab8b2dda
https://github.com/lxc/lxc/commit/0a4f0d02d83c26f1ac8b637b7ca11546ab8b2dda
Author: Christian Brauner <christian at brauner.io>
Date: 2018-08-18 (Sat, 18 Aug 2018)
Changed paths:
M src/lxc/storage/loop.c
Log Message:
-----------
Merge pull request #2545 from ljagiello/integer-overflow
storage/loop.c: integer overflow
Compare: https://github.com/lxc/lxc/compare/2957be64da84...0a4f0d02d83c
**NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.
More information about the lxc-devel
mailing list