aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-10-08 08:18:21 -0400
committerJohn Thacker <johnthacker@gmail.com>2023-10-08 14:53:12 +0000
commitae3b2033e45be3cb4e703e48be85ba387f91b3a5 (patch)
treeee4e89c06f1df13bab7cad754078fd60e27708f5
parenteb5516d1d35191541a13717c4d2c38b98e0e9d75 (diff)
sctp tap: Fix copying checksum string
In [g_]strlcpy, the dest_size parameter is the buffer size, not the number of bytes to copy. Fix truncating the last byte of the string of the checksum type when copying. This affects display in the SCTP association dialogs, etc.
-rw-r--r--ui/tap-sctp-analysis.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/tap-sctp-analysis.c b/ui/tap-sctp-analysis.c
index 6afd0403a3..9a4427a4cd 100644
--- a/ui/tap-sctp-analysis.c
+++ b/ui/tap-sctp-analysis.c
@@ -194,7 +194,7 @@ calc_checksum(const struct _sctp_info *check_data, sctp_assoc_info_t *data)
if ((float)(data->n_adler32_correct*1.0/data->n_adler32_calculated) > 0.5)
{
char str[] = "ADLER32";
- (void) g_strlcpy(data->checksum_type, str, strlen(str));
+ (void) g_strlcpy(data->checksum_type, str, 8);
data->n_checksum_errors=(data->n_adler32_calculated-data->n_adler32_correct);
ok = TRUE;
}
@@ -205,7 +205,7 @@ calc_checksum(const struct _sctp_info *check_data, sctp_assoc_info_t *data)
if ((float)(data->n_crc32c_correct*1.0/data->n_crc32c_calculated) > 0.5)
{
char str[] = "CRC32C";
- (void) g_strlcpy(data->checksum_type, str, strlen(str));
+ (void) g_strlcpy(data->checksum_type, str, 8);
data->n_checksum_errors=data->n_crc32c_calculated-data->n_crc32c_correct;
ok = TRUE;
}
@@ -214,7 +214,7 @@ calc_checksum(const struct _sctp_info *check_data, sctp_assoc_info_t *data)
if (!ok)
{
char str[] = "UNKNOWN";
- (void) g_strlcpy(data->checksum_type, str, strlen(str));
+ (void) g_strlcpy(data->checksum_type, str, 8);
data->n_checksum_errors=0;
}