Handle the if_fcslen option as having an unsigned 1-byte value.
authorGuy Harris <gharris@sonic.net>
Tue, 28 Nov 2023 06:58:41 +0000 (22:58 -0800)
committerGuy Harris <gharris@sonic.net>
Tue, 28 Nov 2023 06:58:41 +0000 (22:58 -0800)
That's how it's defined in pcapng.  Internally, we have a per-interface
FCS length value that's a signed 32-bit value, with -1 meaning
"unknown", but all possible values of if_fcslen fit in there.

When printing it, print it as unsigned.

wiretap/wtap.c

index 4f3ee071a8ceec720ed4a5320a50814411813c12..c0877aff9d3b6b66ffa3d7aa412e7595388bbb49 100644 (file)
@@ -366,7 +366,6 @@ wtap_get_debug_if_descr(const wtap_block_t if_descr,
        wtapng_if_descr_mandatory_t* if_descr_mand;
        GString *info = g_string_new("");
        guint64 tmp64;
-       gint8 itmp8;
        guint8 tmp8;
        if_filter_opt_t if_filter;
 
@@ -413,10 +412,10 @@ wtap_get_debug_if_descr(const wtap_block_t if_descr,
                        if_descr_mand->snap_len,
                        line_end);
 
-       if (wtap_block_get_uint8_option_value(if_descr, OPT_IDB_FCSLEN, &itmp8) == WTAP_OPTTYPE_SUCCESS) {
+       if (wtap_block_get_uint8_option_value(if_descr, OPT_IDB_FCSLEN, &tmp8) == WTAP_OPTTYPE_SUCCESS) {
                g_string_append_printf(info,
-                               "%*cFCS length = %d%s", indent, ' ',
-                               itmp8,
+                               "%*cFCS length = %u%s", indent, ' ',
+                               tmp8,
                                line_end);
        }