Added a check on log strings to avoid issue with badly formated strings.
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4946 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -160,6 +160,29 @@ gboolean ui_callback_on_about(GtkWidget *widget, gpointer data)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gint ui_callback_check_string (const char *string, const gint lenght, const guint message_number)
|
||||
{
|
||||
gint real_length;
|
||||
|
||||
real_length = strnlen (string, lenght);
|
||||
if (lenght != real_length)
|
||||
{
|
||||
if (message_number)
|
||||
{
|
||||
g_warning("Bad string format for message %u, '\\0' found before end of string (%d/%d)\n", message_number, real_length, lenght);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning("Bad string format, '\\0' found before end of string (%d/%d)\n", real_length, lenght);
|
||||
}
|
||||
return (real_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (lenght);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path,
|
||||
gboolean path_currently_selected, gpointer user_data)
|
||||
{
|
||||
@@ -325,6 +348,7 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
|
||||
message_header_type_size = get_message_header_type_size ();
|
||||
data = (gchar *) buffer_at_offset ((buffer_t*) buffer, message_header_type_size);
|
||||
data_size = get_message_size ((buffer_t*) buffer);
|
||||
data_size = ui_callback_check_string (data, data_size, message_number);
|
||||
|
||||
g_info(" dump message %d: header type size: %u, data size: %u, buffer %p, follow last %d",
|
||||
message_number, message_header_type_size, data_size, buffer, ui_main_data.follow_last);
|
||||
@@ -446,7 +470,7 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data)
|
||||
message_header_type_size = get_message_header_type_size ();
|
||||
string_terminal = (gchar *) buffer_at_offset ((buffer_t*) signal_buffer, message_header_type_size);
|
||||
string_terminal_size = get_message_size ((buffer_t*) signal_buffer);
|
||||
|
||||
string_terminal_size = ui_callback_check_string (string_terminal, string_terminal_size, signal_buffer->message_number);
|
||||
ui_notebook_terminal_append_data(string_terminal, string_terminal_size);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,9 @@ gboolean ui_callback_on_enable_filters(GtkWidget *widget,
|
||||
gboolean ui_callback_on_about(GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
void ui_signal_add_to_list(gpointer data,
|
||||
gpointer user_data);
|
||||
gint ui_callback_check_string (const char *string,
|
||||
const gint lenght,
|
||||
const guint message_number);
|
||||
|
||||
gboolean ui_callback_on_connect(GtkWidget *widget,
|
||||
gpointer data);
|
||||
@@ -43,6 +44,9 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection,
|
||||
gboolean path_currently_selected,
|
||||
gpointer userdata);
|
||||
|
||||
void ui_signal_add_to_list(gpointer data,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean ui_callback_on_menu_enable (GtkWidget *widget, gpointer data);
|
||||
|
||||
gboolean ui_callback_on_menu_color (GtkWidget *widget, gpointer data);
|
||||
|
||||
@@ -21,7 +21,7 @@ int ui_notification_dialog(GtkMessageType type, gboolean cancel, const char *tit
|
||||
|
||||
g_warning("%s", buffer);
|
||||
|
||||
dialogbox = gtk_message_dialog_new (GTK_WINDOW(ui_main_data.window), GTK_DIALOG_MODAL, type,
|
||||
dialogbox = gtk_message_dialog_new (GTK_WINDOW(ui_main_data.window), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, type,
|
||||
cancel ? GTK_BUTTONS_OK_CANCEL : GTK_BUTTONS_OK, "%s",
|
||||
buffer);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG(dialogbox), GTK_RESPONSE_OK);
|
||||
|
||||
Reference in New Issue
Block a user