aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/epan
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-04-30 03:18:25 -0700
committerGuy Harris <gharris@sonic.net>2021-04-30 03:19:19 -0700
commit57a1514ac74527651ad42dca3041f3f53509317e (patch)
treea69a01eaeac3d625a5312930fa81f0a3c6b12e96 /plugins/epan
parent09147397007c5456fd5acd4794b5ba15330bdad3 (diff)
Cast away the return value of g_strlcpy() and g_strlcat().
Most of the time, the return value tells us nothing useful, as we've already decided that we're perfectly willing to live with string truncation. Hopefully this keeps Coverity from whining that those routines could return an error code (NARRATOR: They don't) and thus that we're ignoring the possibility of failure (as indicated, we've already decided that we can live with string truncation, so truncation is *NOT* a failure).
Diffstat (limited to 'plugins/epan')
-rw-r--r--plugins/epan/ethercat/packet-ecatmb.c14
-rw-r--r--plugins/epan/irda/packet-ircomm.c16
-rw-r--r--plugins/epan/irda/packet-irda.c138
-rw-r--r--plugins/epan/mate/mate_util.c2
-rw-r--r--plugins/epan/profinet/packet-dcerpc-pn-io.c2
-rw-r--r--plugins/epan/profinet/packet-pn.c2
6 files changed, 87 insertions, 87 deletions
diff --git a/plugins/epan/ethercat/packet-ecatmb.c b/plugins/epan/ethercat/packet-ecatmb.c
index 2049c648bd..696a681db0 100644
--- a/plugins/epan/ethercat/packet-ecatmb.c
+++ b/plugins/epan/ethercat/packet-ecatmb.c
@@ -428,19 +428,19 @@ static void SoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, gu
SoEIdToString(tmp, soe.anSoeHeaderDataUnion.IDN, sizeof(tmp)-1);
elm[0] = '\0';
if ( soe.anSoeHeaderControlUnion.v.DataState )
- g_strlcat(elm, "D", 50);
+ (void) g_strlcat(elm, "D", 50);
if ( soe.anSoeHeaderControlUnion.v.Name )
- g_strlcat(elm, "N", 50);
+ (void) g_strlcat(elm, "N", 50);
if ( soe.anSoeHeaderControlUnion.v.Attribute )
- g_strlcat(elm, "A", 50);
+ (void) g_strlcat(elm, "A", 50);
if ( soe.anSoeHeaderControlUnion.v.Unit )
- g_strlcat(elm, "U", 50);
+ (void) g_strlcat(elm, "U", 50);
if ( soe.anSoeHeaderControlUnion.v.Min )
- g_strlcat(elm, "I", 50);
+ (void) g_strlcat(elm, "I", 50);
if ( soe.anSoeHeaderControlUnion.v.Max )
- g_strlcat(elm, "X", 50);
+ (void) g_strlcat(elm, "X", 50);
if ( soe.anSoeHeaderControlUnion.v.Value )
- g_strlcat(elm, "V", 50);
+ (void) g_strlcat(elm, "V", 50);
switch ( soe.anSoeHeaderControlUnion.v.OpCode )
{
case ECAT_SOE_OPCODE_RRQ:
diff --git a/plugins/epan/irda/packet-ircomm.c b/plugins/epan/irda/packet-ircomm.c
index 9fd378f96b..01cedce377 100644
--- a/plugins/epan/irda/packet-ircomm.c
+++ b/plugins/epan/irda/packet-ircomm.c
@@ -257,15 +257,15 @@ static gboolean dissect_ircomm_parameters(tvbuff_t* tvb, guint offset, packet_in
pv = tvb_get_guint8(tvb, offset+2);
if (pv & IRCOMM_3_WIRE_RAW)
- g_strlcat(buf, ", 3-Wire raw", 256);
+ (void) g_strlcat(buf, ", 3-Wire raw", 256);
if (pv & IRCOMM_3_WIRE)
- g_strlcat(buf, ", 3-Wire", 256);
+ (void) g_strlcat(buf, ", 3-Wire", 256);
if (pv & IRCOMM_9_WIRE)
- g_strlcat(buf, ", 9-Wire", 256);
+ (void) g_strlcat(buf, ", 9-Wire", 256);
if (pv & IRCOMM_CENTRONICS)
- g_strlcat(buf, ", Centronics", 256);
+ (void) g_strlcat(buf, ", Centronics", 256);
- g_strlcat(buf, ")", 256);
+ (void) g_strlcat(buf, ")", 256);
if (strlen(buf) > 2)
proto_item_append_text(ti, "%s", buf+2);
@@ -279,11 +279,11 @@ static gboolean dissect_ircomm_parameters(tvbuff_t* tvb, guint offset, packet_in
pv = tvb_get_guint8(tvb, offset+2);
if (pv & IRCOMM_SERIAL)
- g_strlcat(buf, ", serial", 256);
+ (void) g_strlcat(buf, ", serial", 256);
if (pv & IRCOMM_PARALLEL)
- g_strlcat(buf, ", parallel", 256);
+ (void) g_strlcat(buf, ", parallel", 256);
- g_strlcat(buf, ")", 256);
+ (void) g_strlcat(buf, ")", 256);
if (strlen(buf) > 2)
proto_item_append_text(ti, "%s", buf+2);
diff --git a/plugins/epan/irda/packet-irda.c b/plugins/epan/irda/packet-irda.c
index e68fa1f1ff..9c4a7e197f 100644
--- a/plugins/epan/irda/packet-irda.c
+++ b/plugins/epan/irda/packet-irda.c
@@ -1272,25 +1272,25 @@ static guint dissect_negotiation(tvbuff_t* tvb, proto_tree* tree, guint offset)
proto_item_append_text(ti, ": Baud Rate (");
if (pv & 0x01)
- g_strlcat(buf, ", 2400", 256);
+ (void) g_strlcat(buf, ", 2400", 256);
if (pv & 0x02)
- g_strlcat(buf, ", 9600", 256);
+ (void) g_strlcat(buf, ", 9600", 256);
if (pv & 0x04)
- g_strlcat(buf, ", 19200", 256);
+ (void) g_strlcat(buf, ", 19200", 256);
if (pv & 0x08)
- g_strlcat(buf, ", 38400", 256);
+ (void) g_strlcat(buf, ", 38400", 256);
if (pv & 0x10)
- g_strlcat(buf, ", 57600", 256);
+ (void) g_strlcat(buf, ", 57600", 256);
if (pv & 0x20)
- g_strlcat(buf, ", 115200", 256);
+ (void) g_strlcat(buf, ", 115200", 256);
if (pv & 0x40)
- g_strlcat(buf, ", 576000", 256);
+ (void) g_strlcat(buf, ", 576000", 256);
if (pv & 0x80)
- g_strlcat(buf, ", 1152000", 256);
+ (void) g_strlcat(buf, ", 1152000", 256);
if ((p_len > 1) && (tvb_get_guint8(tvb, offset+3) & 0x01))
- g_strlcat(buf, ", 4000000", 256);
+ (void) g_strlcat(buf, ", 4000000", 256);
- g_strlcat(buf, " bps)", 256);
+ (void) g_strlcat(buf, " bps)", 256);
proto_item_append_text(ti, "%s", buf+2);
@@ -1300,15 +1300,15 @@ static guint dissect_negotiation(tvbuff_t* tvb, proto_tree* tree, guint offset)
proto_item_append_text(ti, ": Maximum Turn Time (");
if (pv & 0x01)
- g_strlcat(buf, ", 500", 256);
+ (void) g_strlcat(buf, ", 500", 256);
if (pv & 0x02)
- g_strlcat(buf, ", 250", 256);
+ (void) g_strlcat(buf, ", 250", 256);
if (pv & 0x04)
- g_strlcat(buf, ", 100", 256);
+ (void) g_strlcat(buf, ", 100", 256);
if (pv & 0x08)
- g_strlcat(buf, ", 50", 256);
+ (void) g_strlcat(buf, ", 50", 256);
- g_strlcat(buf, " ms)", 256);
+ (void) g_strlcat(buf, " ms)", 256);
proto_item_append_text(ti, "%s", buf+2);
@@ -1318,19 +1318,19 @@ static guint dissect_negotiation(tvbuff_t* tvb, proto_tree* tree, guint offset)
proto_item_append_text(ti, ": Data Size (");
if (pv & 0x01)
- g_strlcat(buf, ", 64", 256);
+ (void) g_strlcat(buf, ", 64", 256);
if (pv & 0x02)
- g_strlcat(buf, ", 128", 256);
+ (void) g_strlcat(buf, ", 128", 256);
if (pv & 0x04)
- g_strlcat(buf, ", 256", 256);
+ (void) g_strlcat(buf, ", 256", 256);
if (pv & 0x08)
- g_strlcat(buf, ", 512", 256);
+ (void) g_strlcat(buf, ", 512", 256);
if (pv & 0x10)
- g_strlcat(buf, ", 1024", 256);
+ (void) g_strlcat(buf, ", 1024", 256);
if (pv & 0x20)
- g_strlcat(buf, ", 2048", 256);
+ (void) g_strlcat(buf, ", 2048", 256);
- g_strlcat(buf, " bytes)", 256);
+ (void) g_strlcat(buf, " bytes)", 256);
proto_item_append_text(ti, "%s", buf+2);
@@ -1340,21 +1340,21 @@ static guint dissect_negotiation(tvbuff_t* tvb, proto_tree* tree, guint offset)
proto_item_append_text(ti, ": Window Size (");
if (pv & 0x01)
- g_strlcat(buf, ", 1", 256);
+ (void) g_strlcat(buf, ", 1", 256);
if (pv & 0x02)
- g_strlcat(buf, ", 2", 256);
+ (void) g_strlcat(buf, ", 2", 256);
if (pv & 0x04)
- g_strlcat(buf, ", 3", 256);
+ (void) g_strlcat(buf, ", 3", 256);
if (pv & 0x08)
- g_strlcat(buf, ", 4", 256);
+ (void) g_strlcat(buf, ", 4", 256);
if (pv & 0x10)
- g_strlcat(buf, ", 5", 256);
+ (void) g_strlcat(buf, ", 5", 256);
if (pv & 0x20)
- g_strlcat(buf, ", 6", 256);
+ (void) g_strlcat(buf, ", 6", 256);
if (pv & 0x40)
- g_strlcat(buf, ", 7", 256);
+ (void) g_strlcat(buf, ", 7", 256);
- g_strlcat(buf, " frame window)", 256);
+ (void) g_strlcat(buf, " frame window)", 256);
proto_item_append_text(ti, "%s", buf+2);
@@ -1364,23 +1364,23 @@ static guint dissect_negotiation(tvbuff_t* tvb, proto_tree* tree, guint offset)
proto_item_append_text(ti, ": Additional BOFs (");
if (pv & 0x01)
- g_strlcat(buf, ", 48", 256);
+ (void) g_strlcat(buf, ", 48", 256);
if (pv & 0x02)
- g_strlcat(buf, ", 24", 256);
+ (void) g_strlcat(buf, ", 24", 256);
if (pv & 0x04)
- g_strlcat(buf, ", 12", 256);
+ (void) g_strlcat(buf, ", 12", 256);
if (pv & 0x08)
- g_strlcat(buf, ", 5", 256);
+ (void) g_strlcat(buf, ", 5", 256);
if (pv & 0x10)
- g_strlcat(buf, ", 3", 256);
+ (void) g_strlcat(buf, ", 3", 256);
if (pv & 0x20)
- g_strlcat(buf, ", 2", 256);
+ (void) g_strlcat(buf, ", 2", 256);
if (pv & 0x40)
- g_strlcat(buf, ", 1", 256);
+ (void) g_strlcat(buf, ", 1", 256);
if (pv & 0x80)
- g_strlcat(buf, ", 0", 256);
+ (void) g_strlcat(buf, ", 0", 256);
- g_strlcat(buf, " additional BOFs at 115200)", 256);
+ (void) g_strlcat(buf, " additional BOFs at 115200)", 256);
proto_item_append_text(ti, "%s", buf+2);
@@ -1390,23 +1390,23 @@ static guint dissect_negotiation(tvbuff_t* tvb, proto_tree* tree, guint offset)
proto_item_append_text(ti, ": Minimum Turn Time (");
if (pv & 0x01)
- g_strlcat(buf, ", 10", 256);
+ (void) g_strlcat(buf, ", 10", 256);
if (pv & 0x02)
- g_strlcat(buf, ", 5", 256);
+ (void) g_strlcat(buf, ", 5", 256);
if (pv & 0x04)
- g_strlcat(buf, ", 1", 256);
+ (void) g_strlcat(buf, ", 1", 256);
if (pv & 0x08)
- g_strlcat(buf, ", 0.5", 256);
+ (void) g_strlcat(buf, ", 0.5", 256);
if (pv & 0x10)
- g_strlcat(buf, ", 0.1", 256);
+ (void) g_strlcat(buf, ", 0.1", 256);
if (pv & 0x20)
- g_strlcat(buf, ", 0.05", 256);
+ (void) g_strlcat(buf, ", 0.05", 256);
if (pv & 0x40)
- g_strlcat(buf, ", 0.01", 256);
+ (void) g_strlcat(buf, ", 0.01", 256);
if (pv & 0x80)
- g_strlcat(buf, ", 0", 256);
+ (void) g_strlcat(buf, ", 0", 256);
- g_strlcat(buf, " ms)", 256);
+ (void) g_strlcat(buf, " ms)", 256);
proto_item_append_text(ti, "%s", buf+2);
@@ -1416,23 +1416,23 @@ static guint dissect_negotiation(tvbuff_t* tvb, proto_tree* tree, guint offset)
proto_item_append_text(ti, ": Link Disconnect/Threshold Time (");
if (pv & 0x01)
- g_strlcat(buf, ", 3/0", 256);
+ (void) g_strlcat(buf, ", 3/0", 256);
if (pv & 0x02)
- g_strlcat(buf, ", 8/3", 256);
+ (void) g_strlcat(buf, ", 8/3", 256);
if (pv & 0x04)
- g_strlcat(buf, ", 12/3", 256);
+ (void) g_strlcat(buf, ", 12/3", 256);
if (pv & 0x08)
- g_strlcat(buf, ", 16/3", 256);
+ (void) g_strlcat(buf, ", 16/3", 256);
if (pv & 0x10)
- g_strlcat(buf, ", 20/3", 256);
+ (void) g_strlcat(buf, ", 20/3", 256);
if (pv & 0x20)
- g_strlcat(buf, ", 25/3", 256);
+ (void) g_strlcat(buf, ", 25/3", 256);
if (pv & 0x40)
- g_strlcat(buf, ", 30/3", 256);
+ (void) g_strlcat(buf, ", 30/3", 256);
if (pv & 0x80)
- g_strlcat(buf, ", 40/3", 256);
+ (void) g_strlcat(buf, ", 40/3", 256);
- g_strlcat(buf, " s)", 256);
+ (void) g_strlcat(buf, " s)", 256);
proto_item_append_text(ti, "%s", buf+2);
@@ -1556,29 +1556,29 @@ static void dissect_xid(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, pro
service_hints[0] = 0;
if (hint1 & 0x01)
- g_strlcat(service_hints, ", PnP Compatible", 256);
+ (void) g_strlcat(service_hints, ", PnP Compatible", 256);
if (hint1 & 0x02)
- g_strlcat(service_hints, ", PDA/Palmtop", 256);
+ (void) g_strlcat(service_hints, ", PDA/Palmtop", 256);
if (hint1 & 0x04)
- g_strlcat(service_hints, ", Computer", 256);
+ (void) g_strlcat(service_hints, ", Computer", 256);
if (hint1 & 0x08)
- g_strlcat(service_hints, ", Printer", 256);
+ (void) g_strlcat(service_hints, ", Printer", 256);
if (hint1 & 0x10)
- g_strlcat(service_hints, ", Modem", 256);
+ (void) g_strlcat(service_hints, ", Modem", 256);
if (hint1 & 0x20)
- g_strlcat(service_hints, ", Fax", 256);
+ (void) g_strlcat(service_hints, ", Fax", 256);
if (hint1 & 0x40)
- g_strlcat(service_hints, ", LAN Access", 256);
+ (void) g_strlcat(service_hints, ", LAN Access", 256);
if (hint2 & 0x01)
- g_strlcat(service_hints, ", Telephony", 256);
+ (void) g_strlcat(service_hints, ", Telephony", 256);
if (hint2 & 0x02)
- g_strlcat(service_hints, ", File Server", 256);
+ (void) g_strlcat(service_hints, ", File Server", 256);
if (hint2 & 0x04)
- g_strlcat(service_hints, ", IrCOMM", 256);
+ (void) g_strlcat(service_hints, ", IrCOMM", 256);
if (hint2 & 0x20)
- g_strlcat(service_hints, ", OBEX", 256);
+ (void) g_strlcat(service_hints, ", OBEX", 256);
- g_strlcat(service_hints, ")", 256);
+ (void) g_strlcat(service_hints, ")", 256);
service_hints[0] = ' ';
service_hints[1] = '(';
diff --git a/plugins/epan/mate/mate_util.c b/plugins/epan/mate/mate_util.c
index 84cd6ca830..605c990726 100644
--- a/plugins/epan/mate/mate_util.c
+++ b/plugins/epan/mate/mate_util.c
@@ -127,7 +127,7 @@ gchar* scs_subscribe(SCS_collection* c, const gchar* s) {
}
orig = (gchar *)g_slice_alloc(len);
- g_strlcpy(orig,s,len);
+ (void) g_strlcpy(orig,s,len);
g_hash_table_insert(c->hash,orig,ip);
}
diff --git a/plugins/epan/profinet/packet-dcerpc-pn-io.c b/plugins/epan/profinet/packet-dcerpc-pn-io.c
index c6d6ba4a55..b0f669f30b 100644
--- a/plugins/epan/profinet/packet-dcerpc-pn-io.c
+++ b/plugins/epan/profinet/packet-dcerpc-pn-io.c
@@ -9098,7 +9098,7 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
io_data_object = wmem_new0(wmem_file_scope(), ioDataObject);
io_data_object->profisafeSupported = FALSE;
io_data_object->moduleNameStr = (gchar*)wmem_alloc(wmem_file_scope(), MAX_NAMELENGTH);
- g_strlcpy(io_data_object->moduleNameStr, "Unknown", MAX_NAMELENGTH);
+ (void) g_strlcpy(io_data_object->moduleNameStr, "Unknown", MAX_NAMELENGTH);
vendorMatch = FALSE;
deviceMatch = FALSE;
gsdmlFoundFlag = FALSE;
diff --git a/plugins/epan/profinet/packet-pn.c b/plugins/epan/profinet/packet-pn.c
index b906a5dba6..c5c29cf583 100644
--- a/plugins/epan/profinet/packet-pn.c
+++ b/plugins/epan/profinet/packet-pn.c
@@ -1448,7 +1448,7 @@ char *pn_fgets(char *str, int n, FILE *stream)
/* Check we have space left in the buffer to move the trailing bytes after the comment end */
size_t remaining_bytes = strlen(comment_end_end) + 1;
if (remaining_bytes < remaining_space) {
- g_strlcat(str, comment_end_end, n);
+ (void) g_strlcat(str, comment_end_end, n);
}
else {
/* Seek the file back to the comment end so the next read picks it up */