# HG changeset patch # User Roy Marples # Date 1590832309 0 # Node ID a986083da0babe687c0864c261c736a2b39aca90 # Parent cab28576ec7e70257461877664d3d1d3e79c0f33 Fix some clang analyzer issues diff -r cab28576ec7e -r a986083da0ba src/arp.c --- a/src/arp.c Fri May 29 22:33:30 2020 +0300 +++ b/src/arp.c Sat May 30 09:51:49 2020 +0000 @@ -538,7 +538,7 @@ } TAILQ_INIT(&state->arp_states); } else { - if (addr && (astate = arp_find(ifp, addr))) + if ((astate = arp_find(ifp, addr)) != NULL) return astate; } diff -r cab28576ec7e -r a986083da0ba src/common.c --- a/src/common.c Fri May 29 22:33:30 2020 +0300 +++ b/src/common.c Sat May 30 09:51:49 2020 +0000 @@ -160,6 +160,8 @@ do { p = *buf; + if (*buf == NULL) + return NULL; c = memchr(*buf, '\n', (size_t)*buflen); if (c == NULL) { c = memchr(*buf, '\0', (size_t)*buflen); diff -r cab28576ec7e -r a986083da0ba src/dhcp.c --- a/src/dhcp.c Fri May 29 22:33:30 2020 +0300 +++ b/src/dhcp.c Sat May 30 09:51:49 2020 +0000 @@ -3753,7 +3753,7 @@ dhcp_init(struct interface *ifp) { struct dhcp_state *state; - const struct if_options *ifo; + struct if_options *ifo; uint8_t len; char buf[(sizeof(ifo->clientid) - 1) * 3]; @@ -3824,7 +3824,7 @@ * at device start. */ return 0; - if (ifo->options & DHCPCD_CLIENTID) + if (ifo->options & DHCPCD_CLIENTID && state->clientid != NULL) logdebugx("%s: using ClientID %s", ifp->name, hwaddr_ntoa(state->clientid + 1, state->clientid[0], buf, sizeof(buf))); diff -r cab28576ec7e -r a986083da0ba src/dhcpcd.c --- a/src/dhcpcd.c Fri May 29 22:33:30 2020 +0300 +++ b/src/dhcpcd.c Sat May 30 09:51:49 2020 +0000 @@ -1267,7 +1267,8 @@ loginfox("%s: new hardware address: %s", ifp->name, hwaddr_ntoa(hwaddr, hwlen, buf, sizeof(buf))); ifp->hwlen = hwlen; - memcpy(ifp->hwaddr, hwaddr, hwlen); + if (hwaddr != NULL) + memcpy(ifp->hwaddr, hwaddr, hwlen); } static void @@ -2062,7 +2063,7 @@ #ifdef USE_SIGNALS for (si = 0; si < dhcpcd_signals_ignore_len; si++) - signal(dhcpcd_signals_ignore[i], SIG_IGN); + signal(dhcpcd_signals_ignore[si], SIG_IGN); /* Save signal mask, block and redirect signals to our handler */ if (eloop_signal_set_cb(ctx.eloop, diff -r cab28576ec7e -r a986083da0ba src/if.c --- a/src/if.c Fri May 29 22:33:30 2020 +0300 +++ b/src/if.c Sat May 30 09:51:49 2020 +0000 @@ -686,10 +686,15 @@ errno = e; return -1; } - *ep-- = '\0'; + *ep = '\0'; +#ifdef __sun + ep--; +#endif } else { spec->lun = -1; +#ifdef __sun ep = spec->drvname + strlen(spec->drvname) - 1; +#endif } strlcpy(spec->devname, spec->drvname, sizeof(spec->devname)); diff -r cab28576ec7e -r a986083da0ba src/script.c --- a/src/script.c Fri May 29 22:33:30 2020 +0300 +++ b/src/script.c Sat May 30 09:51:49 2020 +0000 @@ -719,7 +719,7 @@ } #endif - status = script_run(ctx, argv); + script_run(ctx, argv); send_listeners: /* Send to our listeners */