]> The Tcpdump Group git mirrors - tcpdump/commitdiff
CDP: fix "Unchecked return value" found by Coverity
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 8 Dec 2014 20:24:59 +0000 (21:24 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 8 Dec 2014 20:24:59 +0000 (21:24 +0100)
The bounds check is already done before by ND_TCHECK2(*tptr, len).
So we are deliberately ignoring the return values of fn_printn with last
argument NULL (no bounds check).

print-cdp.c

index a725eb6ea4a579607d63f1e9012300fc360fe668..109c04c7d2fe3d65c6a9b4dbb5e718ad2b48fc6d 100644 (file)
@@ -147,7 +147,7 @@ cdp_print(netdissect_options *ndo,
                        if (!ndo->ndo_vflag)
                            ND_PRINT((ndo, ", Device-ID "));
                        ND_PRINT((ndo, "'"));
-                       fn_printn(ndo, tptr, len, NULL);
+                       (void)fn_printn(ndo, tptr, len, NULL);
                        ND_PRINT((ndo, "'"));
                        break;
                    case 0x02: /* Address */
@@ -156,7 +156,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                    case 0x03: /* Port-ID */
                        ND_PRINT((ndo, "'"));
-                       fn_printn(ndo, tptr, len, NULL);
+                       (void)fn_printn(ndo, tptr, len, NULL);
                        ND_PRINT((ndo, "'"));
                        break;
                    case 0x04: /* Capabilities */
@@ -177,7 +177,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                    case 0x06: /* Platform */
                        ND_PRINT((ndo, "'"));
-                       fn_printn(ndo, tptr, len, NULL);
+                       (void)fn_printn(ndo, tptr, len, NULL);
                        ND_PRINT((ndo, "'"));
                        break;
                    case 0x07: /* Prefixes */
@@ -188,7 +188,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                    case 0x09: /* VTP Mgmt Domain  - CDPv2 */
                        ND_PRINT((ndo, "'"));
-                       fn_printn(ndo, tptr, len, NULL);
+                       (void)fn_printn(ndo, tptr, len, NULL);
                        ND_PRINT((ndo, "'"));
                        break;
                    case 0x0a: /* Native VLAN ID - CDPv2 */
@@ -230,7 +230,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                    case 0x14: /* System Name - not documented */
                        ND_PRINT((ndo, "'"));
-                       fn_printn(ndo, tptr, len, NULL);
+                       (void)fn_printn(ndo, tptr, len, NULL);
                        ND_PRINT((ndo, "'"));
                        break;
                    case 0x16: /* System Object ID - not documented */
@@ -243,7 +243,7 @@ cdp_print(netdissect_options *ndo,
                        ND_PRINT((ndo, "0x%02x", *(tptr)));
                        if (len > 1) {
                                ND_PRINT((ndo, "/"));
-                               fn_printn(ndo, tptr + 1, len - 1, NULL);
+                               (void)fn_printn(ndo, tptr + 1, len - 1, NULL);
                        }
                        break;
                    default: