Unverified Commit 0a4f0d02 by Christian Brauner Committed by GitHub

Merge pull request #2545 from ljagiello/integer-overflow

storage/loop.c: integer overflow
parents 2957be64 8737e2a8
...@@ -297,6 +297,7 @@ int loop_umount(struct lxc_storage *bdev) ...@@ -297,6 +297,7 @@ int loop_umount(struct lxc_storage *bdev)
static int do_loop_create(const char *path, uint64_t size, const char *fstype) static int do_loop_create(const char *path, uint64_t size, const char *fstype)
{ {
int fd, ret; int fd, ret;
off_t ret_size;
char cmd_output[MAXPATHLEN]; char cmd_output[MAXPATHLEN];
const char *cmd_args[2] = {fstype, path}; const char *cmd_args[2] = {fstype, path};
...@@ -307,8 +308,8 @@ static int do_loop_create(const char *path, uint64_t size, const char *fstype) ...@@ -307,8 +308,8 @@ static int do_loop_create(const char *path, uint64_t size, const char *fstype)
return -1; return -1;
} }
ret = lseek(fd, size, SEEK_SET); ret_size = lseek(fd, size, SEEK_SET);
if (ret < 0) { if (ret_size < 0) {
SYSERROR("Failed to seek to set new loop file size for loop " SYSERROR("Failed to seek to set new loop file size for loop "
"file \"%s\"", path); "file \"%s\"", path);
close(fd); close(fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment