diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-04-03 13:10:30 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-04-06 13:28:55 +0200 |
commit | 9410ab601acccc44b15d367d965ed36ad937f313 (patch) | |
tree | 2690213e37616ec73649d9dbd94c82a4c8cb19e5 | |
parent | c647672dbf4eda9e8dbeabc2e64558554a410e70 (diff) | |
download | gnutls-9410ab601acccc44b15d367d965ed36ad937f313.tar.gz |
dumbfw: account for extension data padding
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | lib/ext/dumbfw.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/ext/dumbfw.c b/lib/ext/dumbfw.c index 7faff65693..4e56192337 100644 --- a/lib/ext/dumbfw.c +++ b/lib/ext/dumbfw.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2013 Nikos Mavrogiannopoulos + * Copyright (C) 2013-2018 Nikos Mavrogiannopoulos + * Copyright (C) 2018 Red Hat, Inc. * * This file is part of GnuTLS. * @@ -57,15 +58,16 @@ _gnutls_dumbfw_send_params(gnutls_session_t session, int total_size = 0, ret; uint8_t pad[257]; unsigned pad_size; + ssize_t len = extdata->length - sizeof(mbuffer_st); if (session->security_parameters.entity == GNUTLS_SERVER || session->internals.dumbfw == 0 || IS_DTLS(session) != 0 || - (extdata->length < 256 || extdata->length >= 512)) { + (len < 256 || len >= 512)) { return 0; } else { /* 256 <= extdata->length < 512 */ - pad_size = 512 - extdata->length; + pad_size = 512 - len; memset(pad, 0, pad_size); ret = |