aboutgitcodebugslistschat
path: root/dhcp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-21 09:41:13 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-21 09:41:13 +0200
commit627e18fa8ad000ed92405cff3a88c36fd5f3027e (patch)
tree5caf72002139dd6bc80cd424de1730f8602cbb9d /dhcp.c
parentc3f8e4d2cd55e57419478ff849265d1e342e7990 (diff)
downloadpasst-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.gz
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.bz2
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.lz
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.xz
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.zst
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.zip
passt: Add cppcheck target, test, and address resulting warnings
...mostly false positives, but a number of very relevant ones too, in tcp_get_sndbuf(), tcp_conn_from_tap(), and siphash PREAMBLE(). Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'dhcp.c')
-rw-r--r--dhcp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/dhcp.c b/dhcp.c
index 747f719..5169f56 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -212,19 +212,20 @@ static void opt_set_dns_search(struct ctx *c, size_t max_len)
for (i = 0; *c->dns_search[i].n; i++) {
unsigned int n;
- int dup = -1;
+ int count = -1;
char *p;
buf[0] = 0;
for (p = c->dns_search[i].n, n = 1; *p; p++) {
if (*p == '.') {
/* RFC 1035 4.1.4 Message compression */
- dup = opt_dns_search_dup_ptr(opts[119].s, p + 1,
- opts[119].slen);
+ count = opt_dns_search_dup_ptr(opts[119].s,
+ p + 1,
+ opts[119].slen);
- if (dup >= 0) {
+ if (count >= 0) {
buf[n++] = '\xc0';
- buf[n++] = dup;
+ buf[n++] = count;
break;
}
buf[n++] = '.';
@@ -234,7 +235,7 @@ static void opt_set_dns_search(struct ctx *c, size_t max_len)
}
/* The compression pointer is also an end of label */
- if (dup < 0)
+ if (count < 0)
buf[n++] = 0;
if (n >= max_len)