Fix Missed check in c_glib for frame max message size check
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
index f7b8192..3cbb245 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
@@ -96,6 +96,14 @@
guchar *tmpdata;
sz = ntohl (sz);
+ if (sz > t->max_frame_size)
+ {
+ g_set_error (error,
+ THRIFT_TRANSPORT_ERROR,
+ THRIFT_TRANSPORT_ERROR_MAX_MESSAGE_SIZE_REACHED,
+ "Recived an oversized frame,");
+ return result;
+ }
/* create a buffer to hold the data and read that much data */
tmpdata = g_new0 (guchar, sz);
@@ -277,6 +285,7 @@
transport->transport = NULL;
transport->r_buf = g_byte_array_new ();
transport->w_buf = g_byte_array_new ();
+ transport->max_frame_size = DEFAULT_MAX_FRAME_SIZE;
}
/* destructor */
@@ -354,6 +363,10 @@
break;
case PROP_THRIFT_FRAMED_TRANSPORT_CONFIGURATION:
tt->configuration = g_value_dup_object (value);
+ if (tt->configuration != NULL)
+ {
+ transport->max_frame_size = tt->configuration->maxFrameSize_;
+ }
break;
case PROP_THRIFT_FRAMED_TRANSPORT_REMAINING_MESSAGE_SIZE:
tt->remainingMessageSize_ = g_value_get_long (value);
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.h b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.h
index a102061..245cd21 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.h
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.h
@@ -53,6 +53,7 @@
ThriftTransport *transport;
/* private */
+ guint32 max_frame_size;
GByteArray *r_buf;
GByteArray *w_buf;
guint32 r_buf_size;