aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlns <matzeton@googlemail.com>2018-07-23 14:06:28 +0200
committerlns <matzeton@googlemail.com>2018-07-23 14:06:28 +0200
commit6659e12db0deb467e8efee5043844c5080547ba0 (patch)
tree9a995f2d2903bf8e958419d41bcda698a6f30ae8 /src
parent04ab6d9be03c6b431bef0b762a7366934f91d21c (diff)
parentb821e069cd21d212e64cbacc1d3dd1bd22419623 (diff)
Merge branch 'master' of ssh://127.0.0.1:2223/git/potd
Diffstat (limited to 'src')
-rw-r--r--src/jail.c2
-rw-r--r--src/main.c6
-rw-r--r--src/socket.c10
-rw-r--r--src/utils.c5
4 files changed, 18 insertions, 5 deletions
diff --git a/src/jail.c b/src/jail.c
index 7958140..83dc96d 100644
--- a/src/jail.c
+++ b/src/jail.c
@@ -337,7 +337,7 @@ static int jail_childfn(prisoner_process *ctx)
snprintf(path, sizeof path, "%s%s", ctx->newroot, path_shell);
D2("Checking Shell '%s'", path);
if (access(path, R_OK|X_OK))
- FATAL("Shell '%s' is not accessible", path);
+ FATAL("Access to shell '%s'", path);
snprintf(path, sizeof path, "%s%s", ctx->newroot, path_dev);
D2("Mounting devtmpfs to '%s'", path);
diff --git a/src/main.c b/src/main.c
index 9600176..494e235 100644
--- a/src/main.c
+++ b/src/main.c
@@ -241,7 +241,7 @@ static int process_options(int validate_only)
siz = validate_hostport_option(OPT_JAIL, 0);
if (siz && !validate_only) {
jl_siz = siz;
- jl_ctx = (jail_ctx **) calloc(siz, sizeof **jl_ctx);
+ jl_ctx = (jail_ctx **) calloc(siz, sizeof(jail_ctx));
assert(jl_ctx);
ol = NULL;
@@ -265,7 +265,7 @@ static int process_options(int validate_only)
siz = validate_hostport_option(OPT_PROTOCOL, 1);
if (siz && !validate_only) {
prt_siz = siz;
- prt_ctx = (protocol_ctx **) calloc(siz, sizeof **prt_ctx);
+ prt_ctx = (protocol_ctx **) calloc(siz, sizeof(protocol_ctx));
assert(prt_ctx);
ol = NULL;
@@ -290,7 +290,7 @@ static int process_options(int validate_only)
siz = validate_hostport_option(OPT_REDIRECT, 1);
if (siz && !validate_only) {
rdr_siz = siz;
- rdr_ctx = (redirector_ctx **) calloc(siz, sizeof **rdr_ctx);
+ rdr_ctx = (redirector_ctx **) calloc(siz, sizeof(redirector_ctx));
assert(rdr_ctx);
ol = NULL;
diff --git a/src/socket.c b/src/socket.c
index 4f271fe..5b37cf1 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -137,6 +137,8 @@ int socket_bind_in(psocket *psock, struct addrinfo **results)
finalise:
socket_freeaddr(results);
+ /* suppress coverity fals-positive: fd out of scope */
+ /* coverity[leaked_handle] */
return s;
}
@@ -209,6 +211,8 @@ int socket_connect_in(psocket *psock, struct addrinfo **results)
finalise:
socket_freeaddr(results);
+ /* suppress coverity fals-positive: fd out of scope */
+ /* coverity[leaked_handle] */
return s;
}
@@ -329,12 +333,15 @@ ssize_t socket_get_ifnames(const psocket *test_sock, char name[][IFNAMSIZ],
int socket_set_ifaddr(const psocket *test_sock,
const char *ifname, const char *addr, const char *mask)
{
- struct ifreq ifr = {0};
+ struct ifreq ifr;
int sock;
assert(test_sock);
+ memset(&ifr, 0, sizeof ifr);
sock = socket(test_sock->family, test_sock->socktype,
test_sock->protocol);
+ if (sock < 0)
+ return 1;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
ifr.ifr_addr.sa_family = AF_INET;
@@ -345,6 +352,7 @@ int socket_set_ifaddr(const psocket *test_sock,
ioctl(sock, SIOCSIFNETMASK, &ifr);
ioctl(sock, SIOCGIFFLAGS, &ifr);
+ /* coverity[buffer_size_warning] */
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
ifr.ifr_flags |= (IFF_UP | IFF_RUNNING);
diff --git a/src/utils.c b/src/utils.c
index 62ec2e1..172c6b4 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1051,6 +1051,7 @@ int selftest_minimal_requirements(void)
int s;
char buf[32] = {0};
char test[64] = {0};
+
pid_t child_pid;
#ifdef HAVE_SECCOMP
pseccomp_ctx *psc = NULL;
@@ -1100,6 +1101,10 @@ int selftest_minimal_requirements(void)
goto error;
}
+ /*
+ * The following tests do neither work on travis-ci nor on gitlab.
+ * FIXME: fork() broken on some docker containers?
+ */
s = -1;
child_pid = fork();
if (!child_pid) {