From d9a776928dc584a4145d5ccccad07bb5f94dd863 Mon Sep 17 00:00:00 2001
From: Thierry Quemerais <tquemerais@awox.com>
Date: Thu, 19 Mar 2015 11:28:30 +0100
Subject: [PATCH 1/4] Handle supplemental data type > 255.

Signed-off-by: Thierry Quemerais <tquemerais@awox.com>
---
 lib/gnutls_supplemental.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/gnutls_supplemental.c b/lib/gnutls_supplemental.c
index 56ca1e9..eb18a28 100644
--- a/lib/gnutls_supplemental.c
+++ b/lib/gnutls_supplemental.c
@@ -131,8 +131,8 @@ _gnutls_gen_supplemental(gnutls_session_t session, gnutls_buffer_st * buf)
 
 		/* If data were added, store type+length, otherwise reset. */
 		if (buf->length > sizepos + 4) {
-			buf->data[sizepos] = 0;
-			buf->data[sizepos + 1] = p->type;
+			buf->data[sizepos] = (p->type >> 8) & 0xFF;
+			buf->data[sizepos + 1] = (p->type) & 0xFF;
 			buf->data[sizepos + 2] =
 			    ((buf->length - sizepos - 4) >> 8) & 0xFF;
 			buf->data[sizepos + 3] =
-- 
1.9.1

