Unverified Commit bc554fdf by Christian Brauner Committed by GitHub

Merge pull request #3090 from Rachid-Koucha/patch-3

Suppress hardcoded table sizes
parents 9b017958 6da73634
......@@ -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;
......@@ -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);
......
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