coverity: #438136

String not null terminated Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent b608a3d9
...@@ -211,6 +211,7 @@ static bool do_destroy_with_snapshots(struct lxc_container *c) ...@@ -211,6 +211,7 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
int fd; int fd;
int ret; int ret;
int counter = 0; int counter = 0;
ssize_t bytes;
/* Destroy clones. */ /* Destroy clones. */
ret = snprintf(path, MAXPATHLEN, "%s/%s/lxc_snapshots", c->config_path, c->name); ret = snprintf(path, MAXPATHLEN, "%s/%s/lxc_snapshots", c->config_path, c->name);
...@@ -233,10 +234,10 @@ static bool do_destroy_with_snapshots(struct lxc_container *c) ...@@ -233,10 +234,10 @@ static bool do_destroy_with_snapshots(struct lxc_container *c)
return false; return false;
} }
ret = read(fd, buf, fbuf.st_size); bytes = lxc_read_nointr(fd, buf, fbuf.st_size);
if (ret < 0) { close(fd);
fprintf(stderr, "could not read %s\n", path); if (bytes != (ssize_t)fbuf.st_size) {
close(fd); fprintf(stderr, "Could not read %s", path);
free(buf); free(buf);
return false; return false;
} }
......
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