65 lines
2.4 KiB
Diff
65 lines
2.4 KiB
Diff
|
From 28fdce547c417b868c521f87fb58f71ca6b1e3f7 Mon Sep 17 00:00:00 2001
|
||
|
From: Gerald Combs <gerald@wireshark.org>
|
||
|
Date: Thu, 18 May 2023 13:52:48 -0700
|
||
|
Subject: [PATCH] RTPS: Fixup our g_strlcpy dest_sizes
|
||
|
|
||
|
Use the proper dest_size in various g_strlcpy calls.
|
||
|
|
||
|
Fixes #19085
|
||
|
---
|
||
|
epan/dissectors/packet-rtps.c | 22 +++++++++++-----------
|
||
|
1 file changed, 11 insertions(+), 11 deletions(-)
|
||
|
|
||
|
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
|
||
|
index 2884e86faa1..a39202952f6 100644
|
||
|
--- a/epan/dissectors/packet-rtps.c
|
||
|
+++ b/epan/dissectors/packet-rtps.c
|
||
|
@@ -4944,7 +4944,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
|
||
|
++tk_id;
|
||
|
}
|
||
|
|
||
|
- g_strlcpy(type_name, rtps_util_typecode_id_to_string(tk_id), 40);
|
||
|
+ g_strlcpy(type_name, rtps_util_typecode_id_to_string(tk_id), sizeof(type_name));
|
||
|
|
||
|
/* Structure of the typecode data:
|
||
|
*
|
||
|
@@ -5115,7 +5115,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
|
||
|
member_name, -1, NULL, ndds_40_hack);
|
||
|
}
|
||
|
/* Finally prints the name of the struct (if provided) */
|
||
|
- g_strlcpy(type_name, "}", 40);
|
||
|
+ g_strlcpy(type_name, "}", sizeof(type_name));
|
||
|
break;
|
||
|
|
||
|
} /* end of case UNION */
|
||
|
@@ -5286,7 +5286,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
|
||
|
}
|
||
|
}
|
||
|
/* Finally prints the name of the struct (if provided) */
|
||
|
- g_strlcpy(type_name, "}", 40);
|
||
|
+ g_strlcpy(type_name, "}", sizeof(type_name));
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
@@ -5378,7 +5378,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
|
||
|
offset += 4;
|
||
|
alias_name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, alias_name_length, ENC_ASCII);
|
||
|
offset += alias_name_length;
|
||
|
- g_strlcpy(type_name, alias_name, 40);
|
||
|
+ g_strlcpy(type_name, alias_name, sizeof(type_name));
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
@@ -5413,7 +5413,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
|
||
|
if (tk_id == RTI_CDR_TK_VALUE_PARAM) {
|
||
|
type_id_name = "valueparam";
|
||
|
}
|
||
|
- g_snprintf(type_name, 40, "%s '%s'", type_id_name, value_name);
|
||
|
+ g_snprintf(type_name, sizeof(type_name), "%s '%s'", type_id_name, value_name);
|
||
|
break;
|
||
|
}
|
||
|
} /* switch(tk_id) */
|
||
|
--
|
||
|
GitLab
|
||
|
|