forked from osmocom/wireshark
Next attempt to cleanup some string functions, including:
strncpy -> g_strlcpy, strncat -> g_strlcat svn path=/trunk/; revision=24504
This commit is contained in:
parent
4562744a64
commit
7deec480ff
|
@ -1166,8 +1166,7 @@ capture_if_details_802_11_bssid_list(GtkWidget *main_vb, struct ndis_bssid_list
|
|||
/* Vendor */
|
||||
manuf_name = get_manuf_name_if_known(mac);
|
||||
if(manuf_name != NULL) {
|
||||
strncpy(vendor_buff, manuf_name, DETAILS_STR_MAX);
|
||||
vendor_buff[DETAILS_STR_MAX-1] = '\0';
|
||||
g_strlcpy(vendor_buff, manuf_name, DETAILS_STR_MAX);
|
||||
} else {
|
||||
vendor_buff[0] = '\0';
|
||||
}
|
||||
|
|
|
@ -755,12 +755,14 @@ ifopts_write_new_descr(void)
|
|||
* create/cat interface description to new string
|
||||
* (leave space for parens, comma and terminator)
|
||||
*/
|
||||
if (first_if == TRUE)
|
||||
tmp_descr = g_strdup_printf("%s(%s)", ifnm, desc);
|
||||
else
|
||||
tmp_descr = g_strdup_printf(",%s(%s)", ifnm, desc);
|
||||
strncat(new_descr, tmp_descr, MAX_VAL_LEN - strlen(new_descr));
|
||||
if (first_if != TRUE) {
|
||||
g_strlcat (new_descr, ",", MAX_VAL_LEN);
|
||||
}
|
||||
|
||||
tmp_descr = g_strdup_printf("%s(%s)", ifnm, desc);
|
||||
g_strlcat(new_descr, tmp_descr, MAX_VAL_LEN);
|
||||
g_free(tmp_descr);
|
||||
|
||||
/* set first-in-list flag to false */
|
||||
first_if = FALSE;
|
||||
}
|
||||
|
@ -789,7 +791,6 @@ ifopts_write_new_hide(void)
|
|||
gint first_if = TRUE; /* flag to check if first in list */
|
||||
gchar *ifnm;
|
||||
gchar *hide;
|
||||
gchar *tmp_hide;
|
||||
gchar *new_hide;
|
||||
|
||||
/* new preferences "hidden" interfaces string */
|
||||
|
@ -804,19 +805,16 @@ ifopts_write_new_hide(void)
|
|||
if (strcmp("No", hide) == 0)
|
||||
continue;
|
||||
|
||||
/* get interface name */
|
||||
/* get interface name */
|
||||
gtk_clist_get_text(GTK_CLIST(cur_clist), i, 0, &ifnm);
|
||||
|
||||
/*
|
||||
* create/cat interface to new string
|
||||
*/
|
||||
if (first_if == TRUE)
|
||||
tmp_hide = g_strdup_printf("%s", ifnm);
|
||||
else
|
||||
tmp_hide = g_strdup_printf(",%s", ifnm);
|
||||
if (first_if != TRUE)
|
||||
g_strlcat (new_hide, ",", MAX_VAL_LEN);
|
||||
g_strlcat (new_hide, ifnm, MAX_VAL_LEN);
|
||||
|
||||
strncat(new_hide, tmp_hide, MAX_VAL_LEN - strlen(new_hide));
|
||||
g_free(tmp_hide);
|
||||
/* set first-in-list flag to false */
|
||||
first_if = FALSE;
|
||||
}
|
||||
|
|
|
@ -456,7 +456,7 @@ column_list_new_cb(GtkWidget *w _U_, gpointer data _U_) {
|
|||
gchar *str_path;
|
||||
#endif
|
||||
|
||||
cur_fmt = 0;
|
||||
cur_fmt = COL_NUMBER;
|
||||
cfmt = (fmt_data *) g_malloc(sizeof(fmt_data));
|
||||
cfmt->title = g_strdup(title);
|
||||
cfmt->fmt = g_strdup(col_format_to_string(cur_fmt));
|
||||
|
|
|
@ -680,9 +680,9 @@ value_list_sel_cb(GtkTreeSelection *sel, gpointer value_entry_arg)
|
|||
* testing for "false".
|
||||
*/
|
||||
if (value != NULL)
|
||||
strncpy(value_string, "1", 2);
|
||||
g_snprintf(value_string, sizeof value_string, "1");
|
||||
else
|
||||
strncpy(value_string, "0", 2);
|
||||
g_snprintf(value_string, sizeof value_string, "0");
|
||||
} else {
|
||||
/*
|
||||
* Numeric type; get the value corresponding to the
|
||||
|
|
|
@ -328,8 +328,8 @@ static int flow_graph_tcp_add_to_graph(packet_info *pinfo, const struct tcpheade
|
|||
/* copied from packet-tcp */
|
||||
const gchar *fstr[] = {"FIN", "SYN", "RST", "PSH", "ACK", "URG", "ECN", "CWR" };
|
||||
guint i, bpos;
|
||||
guint fpos = 0;
|
||||
gchar flags[64] = "<None>";
|
||||
gboolean flags_found = FALSE;
|
||||
gchar flags[64];
|
||||
|
||||
gai = g_malloc(sizeof(graph_analysis_item_t));
|
||||
gai->frame_num = pinfo->fd->num;
|
||||
|
@ -344,18 +344,21 @@ static int flow_graph_tcp_add_to_graph(packet_info *pinfo, const struct tcpheade
|
|||
gai->port_src=pinfo->srcport;
|
||||
gai->port_dst=pinfo->destport;
|
||||
|
||||
flags[0] = '\0';
|
||||
for (i = 0; i < 8; i++) {
|
||||
bpos = 1 << i;
|
||||
if (tcph->th_flags & bpos) {
|
||||
if (fpos) {
|
||||
strncpy(&flags[fpos], ", ", 64 - fpos - 1);
|
||||
fpos += 2;
|
||||
if (flags_found) {
|
||||
g_strlcat(flags, ", ", 64);
|
||||
}
|
||||
strncpy(&flags[fpos], fstr[i], 64 - fpos - 1);
|
||||
fpos += 3;
|
||||
g_strlcat(flags, fstr[i], 64);
|
||||
flags_found = TRUE;
|
||||
}
|
||||
}
|
||||
flags[fpos] = '\0';
|
||||
if (flags[0] == '\0') {
|
||||
g_snprintf (flags, 64, "<None>");
|
||||
}
|
||||
|
||||
if ((tcph->th_have_seglen)&&(tcph->th_seglen!=0)){
|
||||
gai->frame_label = g_strdup_printf("%s - Len: %u",flags, tcph->th_seglen);
|
||||
}
|
||||
|
|
|
@ -650,7 +650,7 @@ set_app_font_gtk2(const char *fontname)
|
|||
pfont = pango_context_load_font(pc, pfd);
|
||||
|
||||
if (pfont != NULL) {
|
||||
strncpy(appfontname, fontname, 128);
|
||||
g_strlcpy(appfontname, fontname, 128);
|
||||
appfontname[127] = '\0';
|
||||
g_object_set(G_OBJECT(settings), "gtk-font-name", appfontname, NULL);
|
||||
}
|
||||
|
|
|
@ -1160,10 +1160,9 @@ enable_graph(io_stat_graph_t *gio, const char *filter, const char *field)
|
|||
}
|
||||
if(*field){
|
||||
if(real_filter[0]!=0){
|
||||
strncat(real_filter, " && ", 261-strlen(real_filter));
|
||||
g_strlcat(real_filter, " && ", 262);
|
||||
}
|
||||
strncat(real_filter, field, 261-strlen(real_filter));
|
||||
real_filter[261]=0;
|
||||
g_strlcat(real_filter, field, 262);
|
||||
}
|
||||
}
|
||||
return register_tap_listener("frame", gio, real_filter[0]?real_filter:NULL,
|
||||
|
@ -1572,9 +1571,9 @@ create_yscale_max_menu_items(io_stat_t *io, GtkWidget *menu)
|
|||
|
||||
for(i=0;i<MAX_YSCALE;i++){
|
||||
if(yscale_max[i]==LOGARITHMIC_YSCALE){
|
||||
strncpy(str, "Logarithmic", 15);
|
||||
g_strlcpy(str, "Logarithmic", 15);
|
||||
} else if(yscale_max[i]==AUTO_MAX_YSCALE){
|
||||
strncpy(str, "Auto", 15);
|
||||
g_strlcpy(str, "Auto", 15);
|
||||
} else {
|
||||
g_snprintf(str, 15, "%u", yscale_max[i]);
|
||||
}
|
||||
|
|
|
@ -871,7 +871,7 @@ tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data _U_)
|
|||
if (finfo_length == 0) {
|
||||
len_str[0] = '\0';
|
||||
} else if (finfo_length == 1) {
|
||||
strncpy (len_str, ", 1 byte", sizeof len_str);
|
||||
g_strlcpy (len_str, ", 1 byte", sizeof len_str);
|
||||
} else {
|
||||
g_snprintf (len_str, sizeof len_str, ", %d bytes", finfo_length);
|
||||
}
|
||||
|
|
|
@ -189,10 +189,10 @@ mcaststream_on_filter (GtkButton *button _U_,
|
|||
if (selected_stream_fwd)
|
||||
{
|
||||
if (selected_stream_fwd->src_addr.type==AT_IPv6){
|
||||
strncpy(ip_version,"v6",3);
|
||||
g_strlcpy(ip_version,"v6",3);
|
||||
}
|
||||
else{
|
||||
strncpy(ip_version,"",3);
|
||||
ip_version[0] = '\0';
|
||||
}
|
||||
filter_string_fwd = g_strdup_printf(
|
||||
"(ip%s.src==%s && udp.srcport==%u && ip%s.dst==%s && udp.dstport==%u)",
|
||||
|
|
|
@ -1324,8 +1324,8 @@ register_stat_menu_item(
|
|||
*/
|
||||
menupathlen = strlen(toolspath) + 1 + (p - name);
|
||||
menupath = g_malloc(menupathlen);
|
||||
strncpy(menupath, toolspath, strlen(toolspath) + 1);
|
||||
strncat(menupath, name, p - name);
|
||||
g_strlcpy(menupath, toolspath, menupathlen);
|
||||
g_strlcat(menupath, name, menupathlen);
|
||||
|
||||
/*
|
||||
* Does there exist an entry with that path at this
|
||||
|
@ -1363,8 +1363,8 @@ register_stat_menu_item(
|
|||
*/
|
||||
menupathlen = strlen(toolspath) + 1 + strlen(name);
|
||||
menupath = g_malloc(menupathlen);
|
||||
strncpy(menupath, toolspath, strlen(toolspath) + 1);
|
||||
strncat(menupath, name, strlen(name) + 1);
|
||||
g_strlcpy(menupath, toolspath, menupathlen);
|
||||
g_strlcat(menupath, name, menupathlen);
|
||||
|
||||
/*
|
||||
* Construct an item factory entry for the item, and add it to
|
||||
|
|
|
@ -128,8 +128,8 @@ void new_window_cb(GtkWidget *w _U_)
|
|||
for (i = 0; i < cfile.cinfo.num_cols; ++i) {
|
||||
TextPtr = cfile.cinfo.col_data[i];
|
||||
if ((strlen(Title) + strlen(TextPtr)) < NewWinTitleLen - 1) {
|
||||
strncat(Title, TextPtr, NewWinTitleLen - 1);
|
||||
strncat(Title, " ", 2);
|
||||
g_strlcat(Title, TextPtr, NewWinTitleLen);
|
||||
g_strlcat(Title, " ", NewWinTitleLen);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,20 +147,22 @@ pref_show(pref_t *pref, gpointer user_data)
|
|||
GtkWidget *main_tb = user_data;
|
||||
const char *title;
|
||||
char *label_string;
|
||||
size_t label_len;
|
||||
char uint_str[10+1];
|
||||
|
||||
/* Give this preference a label which is its title, followed by a colon,
|
||||
and left-align it. */
|
||||
title = pref->title;
|
||||
label_string = g_malloc(strlen(title) + 2);
|
||||
strncpy(label_string, title, strlen(title) + 1);
|
||||
label_len = strlen(title) + 2;
|
||||
label_string = g_malloc(label_len);
|
||||
g_strlcpy(label_string, title, label_len);
|
||||
|
||||
/*
|
||||
* Sometimes we don't want to append a ':' after a static text string...
|
||||
* If it is needed, we will specify it in the string itself.
|
||||
*/
|
||||
if(pref->type != PREF_STATIC_TEXT)
|
||||
strncat(label_string, ":", 2);
|
||||
g_strlcat(label_string, ":", label_len);
|
||||
|
||||
/* Save the current value of the preference, so that we can revert it if
|
||||
the user does "Apply" and then "Cancel", and create the control for
|
||||
|
@ -303,7 +305,7 @@ module_prefs_show(module_t *module, gpointer user_data)
|
|||
/*
|
||||
* Add this module to the tree.
|
||||
*/
|
||||
strncpy(label_str, module->title, MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, module->title, MAX_TREE_NODE_NAME_LEN);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
ct_node = gtk_ctree_insert_node(GTK_CTREE(cts->tree), cts->node, NULL,
|
||||
&label_ptr, 5, NULL, NULL, NULL, NULL, !prefs_module_has_submodules(module),
|
||||
|
@ -571,30 +573,30 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_)
|
|||
cts.page = 0;
|
||||
|
||||
/* Blank Page */
|
||||
strncpy(label_str, "(No Specific Preferences)", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "(No Specific Preferences)", MAX_TREE_NODE_NAME_LEN);
|
||||
prefs_nb_page_add(prefs_nb, label_str, NULL, NULL);
|
||||
blank_page = cts.page++;
|
||||
|
||||
/* GUI prefs */
|
||||
strncpy(label_str, "User Interface", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "User Interface", MAX_TREE_NODE_NAME_LEN);
|
||||
prefs_nb_page_add(prefs_nb, label_str, gui_prefs_show(), E_GUI_PAGE_KEY);
|
||||
gui_iter = prefs_tree_page_add(label_str, cts.page, store, NULL, TRUE);
|
||||
cts.page++;
|
||||
|
||||
/* GUI layout prefs */
|
||||
strncpy(label_str, "Layout", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "Layout", MAX_TREE_NODE_NAME_LEN);
|
||||
prefs_nb_page_add(prefs_nb, label_str, layout_prefs_show(), E_GUI_LAYOUT_PAGE_KEY);
|
||||
prefs_tree_page_add(label_str, cts.page, store, &gui_iter, FALSE);
|
||||
cts.page++;
|
||||
|
||||
/* GUI Column prefs */
|
||||
strncpy(label_str, "Columns", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "Columns", MAX_TREE_NODE_NAME_LEN);
|
||||
prefs_nb_page_add(prefs_nb, label_str, column_prefs_show(), E_GUI_COLUMN_PAGE_KEY);
|
||||
prefs_tree_page_add(label_str, cts.page, store, &gui_iter, FALSE);
|
||||
cts.page++;
|
||||
|
||||
/* GUI Font prefs */
|
||||
strncpy(label_str, "Font", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "Font", MAX_TREE_NODE_NAME_LEN);
|
||||
gui_font_pg = gui_font_prefs_show();
|
||||
prefs_nb_page_add(prefs_nb, label_str, gui_font_pg, E_GUI_FONT_PAGE_KEY);
|
||||
prefs_tree_page_add(label_str, cts.page, store, &gui_iter, FALSE);
|
||||
|
@ -634,7 +636,7 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_)
|
|||
#endif
|
||||
|
||||
/* GUI Colors prefs */
|
||||
strncpy(label_str, "Colors", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "Colors", MAX_TREE_NODE_NAME_LEN);
|
||||
prefs_nb_page_add(prefs_nb, label_str, stream_prefs_show(), E_GUI_COLORS_PAGE_KEY);
|
||||
prefs_tree_page_add(label_str, cts.page, store, &gui_iter, FALSE);
|
||||
cts.page++;
|
||||
|
@ -654,7 +656,7 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_)
|
|||
if (has_wpcap) {
|
||||
#endif /* _WIN32 */
|
||||
/* capture prefs */
|
||||
strncpy(label_str, "Capture", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "Capture", MAX_TREE_NODE_NAME_LEN);
|
||||
prefs_nb_page_add(prefs_nb, label_str, capture_prefs_show(), E_CAPTURE_PAGE_KEY);
|
||||
prefs_tree_page_add(label_str, cts.page, store, NULL, FALSE);
|
||||
cts.page++;
|
||||
|
@ -664,13 +666,13 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_)
|
|||
#endif /* HAVE_LIBPCAP */
|
||||
|
||||
/* Printing prefs */
|
||||
strncpy(label_str, "Printing", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "Printing", MAX_TREE_NODE_NAME_LEN);
|
||||
prefs_nb_page_add(prefs_nb, label_str, printer_prefs_show(), E_PRINT_PAGE_KEY);
|
||||
prefs_tree_page_add(label_str, cts.page, store, NULL, FALSE);
|
||||
cts.page++;
|
||||
|
||||
/* Name resolution prefs */
|
||||
strncpy(label_str, "Name Resolution", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "Name Resolution", MAX_TREE_NODE_NAME_LEN);
|
||||
prefs_nb_page_add(prefs_nb, label_str, nameres_prefs_show(), E_NAMERES_PAGE_KEY);
|
||||
prefs_tree_page_add(label_str, cts.page, store, NULL, FALSE);
|
||||
cts.page++;
|
||||
|
@ -678,7 +680,7 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_)
|
|||
#ifdef HAVE_LIBPORTAUDIO
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
/* RTP player prefs */
|
||||
strncpy(label_str, "RTP Player", MAX_TREE_NODE_NAME_LEN);
|
||||
g_strlcpy(label_str, "RTP Player", MAX_TREE_NODE_NAME_LEN);
|
||||
prefs_nb_page_add(prefs_nb, label_str, rtp_player_prefs_show(), E_RTP_PLAYER_PAGE_KEY);
|
||||
prefs_tree_page_add(label_str, cts.page, store, NULL, FALSE);
|
||||
cts.page++;
|
||||
|
|
|
@ -1265,7 +1265,7 @@ static void dialog_graph_draw(user_data_t* user_data)
|
|||
* Draw "x" for Sequence Errors and "m" for Marks
|
||||
*/
|
||||
/* Draw the labels Fwd and Rev */
|
||||
strncpy(label_string,"<-Fwd",15);
|
||||
g_strlcpy(label_string,"<-Fwd",15);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
lwidth=gdk_string_width(font, label_string);
|
||||
gdk_draw_string(user_data->dlg.dialog_graph.pixmap,
|
||||
|
@ -1283,7 +1283,7 @@ static void dialog_graph_draw(user_data_t* user_data)
|
|||
user_data->dlg.dialog_graph.pixmap_height-bottom_y_border+3,
|
||||
layout);
|
||||
#endif
|
||||
strncpy(label_string,"<-Rev",15);
|
||||
g_strlcpy(label_string,"<-Rev",15);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
lwidth=gdk_string_width(font, label_string);
|
||||
gdk_draw_string(user_data->dlg.dialog_graph.pixmap,
|
||||
|
@ -1320,9 +1320,9 @@ static void dialog_graph_draw(user_data_t* user_data)
|
|||
if(user_data->dlg.dialog_graph.graph[i].items[interval/user_data->dlg.dialog_graph.interval].flags & (STAT_FLAG_WRONG_SEQ|STAT_FLAG_MARKER)){
|
||||
int lwidth;
|
||||
if (user_data->dlg.dialog_graph.graph[i].items[interval/user_data->dlg.dialog_graph.interval].flags & STAT_FLAG_WRONG_SEQ){
|
||||
strncpy(label_string,"x",15);
|
||||
g_strlcpy(label_string,"x",15);
|
||||
} else {
|
||||
strncpy(label_string,"m",15);
|
||||
g_strlcpy(label_string,"m",15);
|
||||
}
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
|
@ -1707,7 +1707,7 @@ static void create_yscale_max_menu_items(user_data_t* user_data, GtkWidget *menu
|
|||
|
||||
for(i=0;i<MAX_YSCALE;i++){
|
||||
if(yscale_max[i]==AUTO_MAX_YSCALE){
|
||||
strncpy(str,"Auto",15);
|
||||
g_strlcpy(str,"Auto",15);
|
||||
} else {
|
||||
g_snprintf(str, 15, "%u ms", yscale_max[i]/1000);
|
||||
}
|
||||
|
@ -3134,20 +3134,16 @@ static void create_rtp_dialog(user_data_t* user_data)
|
|||
gtk_widget_show(main_vb);
|
||||
|
||||
/* Notebooks... */
|
||||
strncpy(str_ip_src, get_addr_name(&(user_data->ip_src_fwd)), 16);
|
||||
str_ip_src[15] = '\0';
|
||||
strncpy(str_ip_dst, get_addr_name(&(user_data->ip_dst_fwd)), 16);
|
||||
str_ip_dst[15] = '\0';
|
||||
g_strlcpy(str_ip_src, get_addr_name(&(user_data->ip_src_fwd)), 16);
|
||||
g_strlcpy(str_ip_dst, get_addr_name(&(user_data->ip_dst_fwd)), 16);
|
||||
|
||||
g_snprintf(label_forward, 149,
|
||||
"Analysing stream from %s port %u to %s port %u SSRC = 0x%X",
|
||||
str_ip_src, user_data->port_src_fwd, str_ip_dst, user_data->port_dst_fwd, user_data->ssrc_fwd);
|
||||
|
||||
|
||||
strncpy(str_ip_src, get_addr_name(&(user_data->ip_src_rev)), 16);
|
||||
str_ip_src[15] = '\0';
|
||||
strncpy(str_ip_dst, get_addr_name(&(user_data->ip_dst_rev)), 16);
|
||||
str_ip_dst[15] = '\0';
|
||||
g_strlcpy(str_ip_src, get_addr_name(&(user_data->ip_src_rev)), 16);
|
||||
g_strlcpy(str_ip_dst, get_addr_name(&(user_data->ip_dst_rev)), 16);
|
||||
|
||||
g_snprintf(label_reverse, 149,
|
||||
"Analysing stream from %s port %u to %s port %u SSRC = 0x%X",
|
||||
|
@ -3488,7 +3484,7 @@ static void rtp_analysis_cb(GtkWidget *w _U_, gpointer data _U_)
|
|||
guint nfound;
|
||||
|
||||
/* Try to compile the filter. */
|
||||
strncpy(filter_text,"rtp && rtp.version && rtp.ssrc && (ip || ipv6)",256);
|
||||
g_strlcpy(filter_text,"rtp && rtp.version && rtp.ssrc && (ip || ipv6)",256);
|
||||
if (!dfilter_compile(filter_text, &sfcode)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, dfilter_error_msg);
|
||||
return;
|
||||
|
|
|
@ -375,10 +375,10 @@ rtpstream_on_filter (GtkButton *button _U_,
|
|||
if (selected_stream_fwd)
|
||||
{
|
||||
if (selected_stream_fwd->src_addr.type==AT_IPv6){
|
||||
strncpy(ip_version,"v6",3);
|
||||
g_strlcpy(ip_version,"v6",3);
|
||||
}
|
||||
else{
|
||||
strncpy(ip_version,"",3);
|
||||
ip_version[0] = '\0';
|
||||
}
|
||||
filter_string_fwd = g_strdup_printf(
|
||||
"(ip%s.src==%s && udp.srcport==%u && ip%s.dst==%s && udp.dstport==%u && rtp.ssrc==0x%X)",
|
||||
|
@ -395,10 +395,10 @@ rtpstream_on_filter (GtkButton *button _U_,
|
|||
if (selected_stream_rev)
|
||||
{
|
||||
if (selected_stream_fwd->src_addr.type==AT_IPv6){
|
||||
strncpy(ip_version,"v6",3);
|
||||
g_strlcpy(ip_version,"v6",3);
|
||||
}
|
||||
else{
|
||||
strncpy(ip_version,"",3);
|
||||
ip_version[0] = '\0';
|
||||
}
|
||||
filter_string_rev = g_strdup_printf(
|
||||
"(ip%s.src==%s && udp.srcport==%u && ip%s.dst==%s && udp.dstport==%u && rtp.ssrc==0x%X)",
|
||||
|
|
|
@ -834,7 +834,7 @@ static void sctp_analyse_cb(struct sctp_analyse* u_data, gboolean ext)
|
|||
int i;
|
||||
guint32 *fn;
|
||||
|
||||
strncpy(filter_text,"sctp",250);
|
||||
g_strlcpy(filter_text,"sctp",250);
|
||||
if (!dfilter_compile(filter_text, &sfcode)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, dfilter_error_msg);
|
||||
return;
|
||||
|
|
|
@ -551,7 +551,7 @@ static void sctp_graph_draw(struct sctp_udata *u_data)
|
|||
}
|
||||
}
|
||||
|
||||
strncpy(label_string, "sec", 15);
|
||||
g_strlcpy(label_string, "sec", 15);
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
lwidth = gdk_string_width(font, label_string);
|
||||
|
|
|
@ -610,7 +610,7 @@ static void sctp_graph_draw(struct sctp_udata *u_data)
|
|||
|
||||
}
|
||||
|
||||
strncpy(label_string, "sec", 15);
|
||||
g_strlcpy(label_string, "sec", 15);
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
lwidth=gdk_string_width(font, label_string);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
if (summary.dfilter) {
|
||||
g_snprintf(string_buff2, SUM_STR_MAX, "%i", summary.filtered_count);
|
||||
} else {
|
||||
strncpy(string_buff2, string_buff, SUM_STR_MAX);
|
||||
g_strlcpy(string_buff2, string_buff, SUM_STR_MAX);
|
||||
}
|
||||
g_snprintf(string_buff3, SUM_STR_MAX, "%i", summary.marked_count);
|
||||
add_string_to_list(list, "Packets", string_buff, string_buff2, string_buff3);
|
||||
|
@ -288,17 +288,17 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
if (seconds > 0) {
|
||||
g_snprintf(string_buff, SUM_STR_MAX, "%.3f sec", seconds);
|
||||
} else {
|
||||
strncpy(string_buff, "", SUM_STR_MAX);
|
||||
string_buff[0] = '\0';
|
||||
}
|
||||
if (summary.dfilter && disp_seconds > 0) {
|
||||
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f sec", disp_seconds);
|
||||
} else {
|
||||
strncpy(string_buff2, "", SUM_STR_MAX);
|
||||
string_buff2[0] = '\0';
|
||||
}
|
||||
if (summary.marked_count && marked_seconds > 0) {
|
||||
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f sec", marked_seconds);
|
||||
} else {
|
||||
strncpy(string_buff3, "", SUM_STR_MAX);
|
||||
string_buff3[0] = '\0';
|
||||
}
|
||||
add_string_to_list(list, "Between first and last packet", string_buff, string_buff2, string_buff3);
|
||||
|
||||
|
@ -306,17 +306,17 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
if (seconds > 0) {
|
||||
g_snprintf(string_buff, SUM_STR_MAX, "%.3f", summary.packet_count/seconds);
|
||||
} else {
|
||||
strncpy(string_buff, "", SUM_STR_MAX);
|
||||
string_buff[0] = '\0';
|
||||
}
|
||||
if(summary.dfilter && disp_seconds > 0) {
|
||||
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", summary.filtered_count/disp_seconds);
|
||||
} else {
|
||||
strncpy(string_buff2, "", SUM_STR_MAX);
|
||||
string_buff2[0] = '\0';
|
||||
}
|
||||
if(summary.marked_count && marked_seconds > 0) {
|
||||
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f", summary.marked_count/marked_seconds);
|
||||
} else {
|
||||
strncpy(string_buff3, "", SUM_STR_MAX);
|
||||
string_buff3[0] = '\0';
|
||||
}
|
||||
add_string_to_list(list, "Avg. packets/sec", string_buff, string_buff2, string_buff3);
|
||||
|
||||
|
@ -326,21 +326,21 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
(float) ((gint64) summary.bytes)/summary.packet_count);
|
||||
} else {
|
||||
strncpy(string_buff, "", SUM_STR_MAX);
|
||||
string_buff[0] = '\0';
|
||||
}
|
||||
if (summary.dfilter && summary.filtered_count > 1) {
|
||||
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f bytes",
|
||||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
(float) ((gint64) summary.filtered_bytes)/summary.filtered_count);
|
||||
} else {
|
||||
strncpy(string_buff2, "", SUM_STR_MAX);
|
||||
string_buff2[0] = '\0';
|
||||
}
|
||||
if (summary.marked_count > 1) {
|
||||
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f bytes",
|
||||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
(float) ((gint64) summary.marked_bytes)/summary.marked_count);
|
||||
} else {
|
||||
strncpy(string_buff3, "", SUM_STR_MAX);
|
||||
string_buff3[0] = '\0';
|
||||
}
|
||||
add_string_to_list(list, "Avg. packet size", string_buff, string_buff2, string_buff3);
|
||||
|
||||
|
@ -349,12 +349,12 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
if (summary.dfilter && summary.filtered_count > 0) {
|
||||
g_snprintf(string_buff2, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.filtered_bytes);
|
||||
} else {
|
||||
strncpy(string_buff2, "", SUM_STR_MAX);
|
||||
string_buff2[0] = '\0';
|
||||
}
|
||||
if (summary.marked_count) {
|
||||
g_snprintf(string_buff3, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.marked_bytes);
|
||||
} else {
|
||||
strncpy(string_buff3, "", SUM_STR_MAX);
|
||||
string_buff3[0] = '\0';
|
||||
}
|
||||
add_string_to_list(list, "Bytes", string_buff, string_buff2, string_buff3);
|
||||
|
||||
|
@ -363,19 +363,19 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
g_snprintf(string_buff, SUM_STR_MAX, "%.3f", ((gint64) summary.bytes)/seconds);
|
||||
} else {
|
||||
strncpy(string_buff, "", SUM_STR_MAX);
|
||||
string_buff[0] = '\0';
|
||||
}
|
||||
if (summary.dfilter && disp_seconds > 0) {
|
||||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", ((gint64) summary.filtered_bytes)/disp_seconds);
|
||||
} else {
|
||||
strncpy(string_buff2, "", SUM_STR_MAX);
|
||||
string_buff2[0] = '\0';
|
||||
}
|
||||
if (summary.marked_count && marked_seconds > 0) {
|
||||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f", ((gint64) summary.marked_bytes)/marked_seconds);
|
||||
} else {
|
||||
strncpy(string_buff3, "", SUM_STR_MAX);
|
||||
string_buff3[0] = '\0';
|
||||
}
|
||||
add_string_to_list(list, "Avg. bytes/sec", string_buff, string_buff2, string_buff3);
|
||||
|
||||
|
@ -385,21 +385,21 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
((gint64) summary.bytes) * 8.0 / (seconds * 1000.0 * 1000.0));
|
||||
} else {
|
||||
strncpy(string_buff, "", SUM_STR_MAX);
|
||||
string_buff[0] = '\0';
|
||||
}
|
||||
if (summary.dfilter && disp_seconds > 0) {
|
||||
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f",
|
||||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
((gint64) summary.filtered_bytes) * 8.0 / (disp_seconds * 1000.0 * 1000.0));
|
||||
} else {
|
||||
strncpy(string_buff2, "", SUM_STR_MAX);
|
||||
string_buff2[0] = '\0';
|
||||
}
|
||||
if (summary.marked_count && marked_seconds > 0) {
|
||||
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f",
|
||||
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
||||
((gint64) summary.marked_bytes) * 8.0 / (marked_seconds * 1000.0 * 1000.0));
|
||||
} else {
|
||||
strncpy(string_buff3, "", SUM_STR_MAX);
|
||||
string_buff3[0] = '\0';
|
||||
}
|
||||
add_string_to_list(list, "Avg. MBit/sec", string_buff, string_buff2, string_buff3);
|
||||
|
||||
|
|
|
@ -121,8 +121,8 @@ alloc_wlan_ep (struct _wlan_hdr *si, packet_info *pinfo _U_)
|
|||
|
||||
SE_COPY_ADDRESS (&ep->bssid, &si->bssid);
|
||||
ep->stats.channel = si->stats.channel;
|
||||
strncpy (ep->stats.ssid, si->stats.ssid, MAX_SSID_LEN);
|
||||
strncpy (ep->stats.protection, si->stats.protection, MAX_PROTECT_LEN);
|
||||
g_strlcpy (ep->stats.ssid, si->stats.ssid, MAX_SSID_LEN);
|
||||
g_strlcpy (ep->stats.protection, si->stats.protection, MAX_PROTECT_LEN);
|
||||
memset(&ep->type, 0, sizeof (int) * 256);
|
||||
ep->number_of_packets = 0;
|
||||
ep->next = NULL;
|
||||
|
@ -209,10 +209,10 @@ wlanstat_packet (void *phs, packet_info *pinfo, epan_dissect_t *edt _U_, const v
|
|||
te->stats.channel = si->stats.channel;
|
||||
}
|
||||
if (te->stats.ssid[0] == 0 && si->stats.ssid[0] != 0) {
|
||||
strncpy (te->stats.ssid, si->stats.ssid, MAX_SSID_LEN);
|
||||
g_strlcpy (te->stats.ssid, si->stats.ssid, MAX_SSID_LEN);
|
||||
}
|
||||
if (te->stats.protection[0] == 0 && si->stats.protection[0] != 0) {
|
||||
strncpy (te->stats.protection, si->stats.protection, MAX_PROTECT_LEN);
|
||||
g_strlcpy (te->stats.protection, si->stats.protection, MAX_PROTECT_LEN);
|
||||
}
|
||||
te->type[si->type]++;
|
||||
te->number_of_packets++;
|
||||
|
|
Loading…
Reference in New Issue