Resolve integer type conversion problem on MSVC

MSVC rightfully complained that there was some conversion from `size_t`
to `unsigned int` that could come with a loss of data. This commit
re-types the corresponding struct field `ctx_buffer::len` to `size_t`.
Also, the function `ctx_buffer_append` has an integer return value
which is supposed to be the (positive) length of the appended data
on success, and a check is inserted that the data to be appended does
not exceed MAX_INT in length.
diff --git a/programs/test/udp_proxy.c b/programs/test/udp_proxy.c
index 0dec409..5797f3d 100644
--- a/programs/test/udp_proxy.c
+++ b/programs/test/udp_proxy.c
@@ -311,7 +311,7 @@
     unsigned num_datagrams;
 
     unsigned char data[MAX_MSG_SIZE];
-    unsigned len;
+    size_t len;
 
 } ctx_buffer;
 
@@ -323,7 +323,7 @@
 
     mbedtls_printf( "  %05u flush    %s: %u bytes, %u datagrams, last %u ms\n",
                     ellapsed_time(), buf->description,
-                    buf->len, buf->num_datagrams,
+                    (unsigned) buf->len, buf->num_datagrams,
                     ellapsed_time() - buf->packet_lifetime );
 
     ret = mbedtls_net_send( buf->ctx, buf->data, buf->len );
@@ -353,6 +353,9 @@
 {
     int ret;
 
+    if( len > (size_t) INT_MAX )
+        return( -1 );
+
     if( len > sizeof( buf->data ) )
     {
         mbedtls_printf( "  ! buffer size %u too large (max %u)\n",
@@ -372,7 +375,7 @@
     if( ++buf->num_datagrams == 1 )
         buf->packet_lifetime = ellapsed_time();
 
-    return( len );
+    return( (int) len );
 }
 #endif /* MBEDTLS_TIMING_C */