diff --git a/dist/tools/tunslip/tapslip6.c b/dist/tools/tunslip/tapslip6.c index 497ad710bdda30947fc3de21ece75376a44c1e93..0ae6605e271ea53b6f362029e87eddb93703abe6 100644 --- a/dist/tools/tunslip/tapslip6.c +++ b/dist/tools/tunslip/tapslip6.c @@ -172,7 +172,6 @@ after_fread: if (ret == 0) { clearerr(inslip); - return; fprintf(stderr, "serial_to_tun: EOF\n"); exit(1); } diff --git a/dist/tools/tunslip/tunslip.c b/dist/tools/tunslip/tunslip.c index 9b8f4a4bfb415101932dc6a026f3a3820293b8aa..117bedc97d7486c26f1dd13093dd64c75747b658 100644 --- a/dist/tools/tunslip/tunslip.c +++ b/dist/tools/tunslip/tunslip.c @@ -307,7 +307,7 @@ done: if (op == DHCP_OPTION_END) { *t++ = op; - *p++; + (*p)++; } optlen = t - pkt.m.options; @@ -535,7 +535,6 @@ after_fread: if (ret == 0) { clearerr(inslip); - return; fprintf(stderr, "serial_to_tun: EOF\n"); exit(1); } diff --git a/dist/tools/tunslip/tunslip6.c b/dist/tools/tunslip/tunslip6.c index 286a459fd4beb695e3668a3527fa9e4e8665b2b0..67ad3a0d5cc051040009d31a8a7f4419224690b9 100644 --- a/dist/tools/tunslip/tunslip6.c +++ b/dist/tools/tunslip/tunslip6.c @@ -118,7 +118,6 @@ stamptime(void) long secs, msecs; struct timeval tv; time_t t; - char timec[20]; gettimeofday(&tv, NULL) ; msecs = tv.tv_usec / 1000; @@ -136,6 +135,7 @@ stamptime(void) fprintf(stderr, "%04li.%03li ", secs, msecs); } else { + char timec[20]; startsecs = secs; startmsecs = msecs; t = time(NULL); @@ -190,6 +190,8 @@ serial_to_tun(FILE *inslip, int outfd) unsigned char inbuf[2000]; } uip; static unsigned int inbufptr = 0; + /* cppcheck-suppress variableScope + * rationale: cannot be reduced if built on linux */ int ret; unsigned char c; @@ -209,7 +211,7 @@ serial_to_tun(FILE *inslip, int outfd) stamptime(); } - fprintf(stderr, "*** dropping large %d byte packet\n", inbufptr); + fprintf(stderr, "*** dropping large %u byte packet\n", inbufptr); inbufptr = 0; } @@ -324,7 +326,7 @@ serial_to_tun(FILE *inslip, int outfd) stamptime(); } - printf("Packet from SLIP of length %d - write TUN\n", inbufptr); + printf("Packet from SLIP of length %u - write TUN\n", inbufptr); if (verbose > 4) { #if WIRESHARK_IMPORT_FORMAT @@ -648,6 +650,8 @@ devopen(const char *dev, int flags) { char t[1024]; strcpy(t, "/dev/"); + /* cppcheck-suppress bufferAccessOutOfBounds + * reason: seems to be a cppcheck bug */ strncat(t, dev, sizeof(t) - 5); return open(t, flags); } @@ -868,10 +872,6 @@ ifconf(const char *tundev, const char *ipaddr) if (prefix != NULL) { *prefix = '\0'; - prefix++; - } - else { - prefix = "64"; } if (timestamp) {