Skip to content

Commit

Permalink
Merge pull request #3090 from Rachid-Koucha/patch-3
Browse files Browse the repository at this point in the history
Suppress hardcoded table sizes
  • Loading branch information
Christian Brauner committed Jul 11, 2019
2 parents 9b01795 + 6da7363 commit bc554fd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lxc/utils.c
Expand Up @@ -1171,8 +1171,8 @@ int safe_mount(const char *src, const char *dest, const char *fstype,
if (srcfd < 0)
return srcfd;

ret = snprintf(srcbuf, 50, "/proc/self/fd/%d", srcfd);
if (ret < 0 || ret > 50) {
ret = snprintf(srcbuf, sizeof(srcbuf), "/proc/self/fd/%d", srcfd);
if (ret < 0 || ret >= (int)sizeof(srcbuf)) {
close(srcfd);
ERROR("Out of memory");
return -EINVAL;
Expand All @@ -1191,8 +1191,8 @@ int safe_mount(const char *src, const char *dest, const char *fstype,
return destfd;
}

ret = snprintf(destbuf, 50, "/proc/self/fd/%d", destfd);
if (ret < 0 || ret > 50) {
ret = snprintf(destbuf, sizeof(destbuf), "/proc/self/fd/%d", destfd);
if (ret < 0 || ret >= (int)sizeof(destbuf)) {
if (srcfd != -1)
close(srcfd);

Expand Down

0 comments on commit bc554fd

Please sign in to comment.