Improved detections and processing of null terminated c string in itti analyzer.
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4599 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -51,13 +51,15 @@ int array_dissect_from_buffer(
|
||||
}
|
||||
|
||||
/* Check if this is an array of 8 bits items and if at least the firsts ones are not null */
|
||||
if ((type_child->size == 8) && ((items - zero_counter) >= 2))
|
||||
if ((type_child->size == 8) && (zero_counter >= 1) && ((items - zero_counter) >= 2))
|
||||
{
|
||||
int end = items - zero_counter;
|
||||
|
||||
/* check if this is a printable string */
|
||||
is_string = TRUE;
|
||||
string = calloc(items + 1, 1);
|
||||
string = malloc(end + 1);
|
||||
|
||||
for (i = 0; i < (items - zero_counter); i++)
|
||||
for (i = 0; i < end; i++)
|
||||
{
|
||||
string[i] = fundamental_read_from_buffer(type_child, buffer, parent_offset, offset + i * type_child->size);
|
||||
if (isprint(string[i]) == 0)
|
||||
@@ -70,7 +72,8 @@ int array_dissect_from_buffer(
|
||||
|
||||
if (is_string)
|
||||
{
|
||||
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%d .. %d] \"%s\"\n", 0, (items - zero_counter - 1), string));
|
||||
string[i] = '\0';
|
||||
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[0 .. %d] \"%s\"\n", end - 1, string));
|
||||
ui_set_signal_text_cb(user_data, cbuf, length);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user