diff options
| author | Roy Marples <roy@marples.name> | 2019-05-03 16:27:35 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2019-05-03 16:27:35 +0100 |
| commit | 7c361f62838e029d4b234f7e772bf8dd5447e798 (patch) | |
| tree | a0be18d9b5f8ec92fafe122c29790dcb83564c73 | |
| parent | ff89567168e3c3ea4669d4f7bb43a3400fef6c28 (diff) | |
| download | dhcpcd-7c361f62838e029d4b234f7e772bf8dd5447e798.tar.xz | |
BSD: Ignore coverity errors
We could do ((char *)rtm) + rtm->rtm_msglen but that looks
more ugly than rtm + 1.
| -rw-r--r-- | src/dhcpcd.c | 3 | ||||
| -rw-r--r-- | src/if-bsd.c | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 67dc3d64..5907fbbe 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -1081,7 +1081,8 @@ dhcpcd_handlelink(void *arg) dhcpcd_linkoverflow(ctx); return; } - logerr(__func__); + if (errno != ENOTSUP) + logerr(__func__); } } diff --git a/src/if-bsd.c b/src/if-bsd.c index 5318bdff..b93aa207 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -655,6 +655,9 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct rt *rt, const struct rt_msghdr *rtm) } #endif + /* We have already checked that at least one address must be + * present after the rtm structure. */ + /* coverity[ptr_arith] */ if (get_addrs(rtm->rtm_addrs, rtm + 1, rtm->rtm_msglen - sizeof(*rtm), rti_info) == -1) return -1; @@ -1099,14 +1102,17 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam) errno = EINVAL; return -1; } - + if (~ifam->ifam_addrs & RTA_IFA) + return 0; if ((ifp = if_findindex(ctx->ifaces, ifam->ifam_index)) == NULL) return 0; + + /* We have already checked that at least one address must be + * present after the ifam structure. */ + /* coverity[ptr_arith] */ if (get_addrs(ifam->ifam_addrs, ifam + 1, ifam->ifam_msglen - sizeof(*ifam), rti_info) == -1) return -1; - if (rti_info[RTAX_IFA] == NULL) - return 0; #ifdef HAVE_IFAM_PID pid = ifam->ifam_pid; @@ -1302,6 +1308,8 @@ if_dispatch(struct dhcpcd_ctx *ctx, const struct rt_msghdr *rtm) return dhcpcd_linkoverflow(ctx); #endif } + + return 0; } int |
