aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/sctp_stat.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-02-29 13:33:37 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-02-29 13:33:37 +0000
commit7deec480ff68e446fe047925619df51d7fe8dacc (patch)
tree5ccaf4cba154244912a56e39003f8ac1bbd169f1 /gtk/sctp_stat.c
parent4562744a64da351cb05e8110ec5983e398af98dd (diff)
Next attempt to cleanup some string functions, including:
strncpy -> g_strlcpy, strncat -> g_strlcat svn path=/trunk/; revision=24504
Diffstat (limited to 'gtk/sctp_stat.c')
-rw-r--r--gtk/sctp_stat.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gtk/sctp_stat.c b/gtk/sctp_stat.c
index f78f1a9ec6..1aefad8a09 100644
--- a/gtk/sctp_stat.c
+++ b/gtk/sctp_stat.c
@@ -264,7 +264,7 @@ static sctp_assoc_info_t *calc_checksum(struct _sctp_info *check_data, sctp_asso
{
if ((float)(data->n_adler32_correct*1.0/data->n_adler32_calculated) > 0.5)
{
- strncpy(data->checksum_type,"ADLER32",8);
+ g_strlcpy(data->checksum_type,"ADLER32",8);
data->n_checksum_errors=(data->n_adler32_calculated-data->n_adler32_correct);
ok = TRUE;
}
@@ -274,7 +274,7 @@ static sctp_assoc_info_t *calc_checksum(struct _sctp_info *check_data, sctp_asso
{
if ((float)(data->n_crc32c_correct*1.0/data->n_crc32c_calculated) > 0.5)
{
- strncpy(data->checksum_type,"CRC32C",8);
+ g_strlcpy(data->checksum_type,"CRC32C",8);
data->n_checksum_errors=data->n_crc32c_calculated-data->n_crc32c_correct;
ok = TRUE;
}
@@ -282,7 +282,7 @@ static sctp_assoc_info_t *calc_checksum(struct _sctp_info *check_data, sctp_asso
if (!ok)
{
- strncpy(data->checksum_type,"UNKNOWN",8);
+ g_strlcpy(data->checksum_type,"UNKNOWN",8);
data->n_checksum_errors=0;
}
@@ -886,11 +886,10 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
str[0] = '\0';
error->chunk_info[0] = '\0';
if ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_CHUNK_ID)
- strncpy(error->chunk_info, val_to_str(tvb_get_guint8(sctp_info->tvb[0],0),chunk_type_values,"Reserved"), 200);
+ g_strlcpy(error->chunk_info, val_to_str(tvb_get_guint8(sctp_info->tvb[0],0),chunk_type_values,"Reserved"), 200);
else
for (chunk_number = 0; chunk_number < sctp_info->number_of_tvbs; chunk_number++)
- strncat(error->chunk_info, val_to_str(tvb_get_guint8(sctp_info->tvb[chunk_number],0),chunk_type_values,"Reserved"), 200 - strlen (error->chunk_info));
- error->chunk_info[199] = '\0';
+ g_strlcat(error->chunk_info, val_to_str(tvb_get_guint8(sctp_info->tvb[chunk_number],0),chunk_type_values,"Reserved"), 200);
error->info_text = "INFOS";
info->error_info_list = g_list_append(info->error_info_list, error);
}