Commit 2d9f22e0 authored by winckel's avatar winckel

Made buffer size dependent on name length to avoid overflow with long names.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4834 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 252ab4c1
......@@ -16,7 +16,7 @@ int field_dissect_from_buffer(
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[200];
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
types_t *type_child;
char array_info[50];
new_line = FALSE;
......
......@@ -28,7 +28,7 @@ int pointer_dissect_from_buffer(
{
DISPLAY_TYPE("Ptr");
}
if (type->child->name && type->child) {
if (type->child && type->child->name) {
/*
INDENTED(stdout, indent, fprintf(stdout, "<%s>0x%08x</%s>\n",
type->child->name, value, type->child->name));
......
......@@ -17,12 +17,12 @@ int struct_dissect_from_buffer(
{
int i;
int length = 0;
char cbuf[200];
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
char *name;
DISPLAY_PARSE_INFO("structure", type->name, offset, parent_offset);
memset (cbuf, 0, 200);
memset (cbuf, 0, sizeof(cbuf));
if (new_line) {
DISPLAY_TYPE("Str");
......
......@@ -13,7 +13,7 @@ int typedef_dissect_from_buffer(
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[200];
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
types_t *type_child = NULL;
DISPLAY_PARSE_INFO("typedef", type->name, offset, parent_offset);
......
......@@ -55,13 +55,13 @@ int union_dissect_from_buffer(
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[200];
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
char *name;
int union_child = 0;
DISPLAY_PARSE_INFO("union", type->name, offset, parent_offset);
memset (cbuf, 0, 200);
memset (cbuf, 0, sizeof(cbuf));
// CHECK_FCT(buffer_has_enouch_data(buffer, offset + parent_offset, type->size / 8));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment