Changeset ac3f500 in mod_gnutls for src/gnutls_io.c


Ignore:
Timestamp:
Jun 18, 2016, 2:58:28 PM (4 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, master, proxy-ticket, upstream
Children:
ef06c74
Parents:
87d507b
git-author:
Thomas Klute <thomas2.klute@…> (06/18/16 14:53:10)
git-committer:
Thomas Klute <thomas2.klute@…> (06/18/16 14:58:28)
Message:

Compatibility code for GnuTLS version < 3.4

  • gnutls_memset() is not available.
  • GNUTLS_MAX_SESSION_ID_SIZE is undefined. GNUTLS_MAX_SESSION_ID serves the same purpose, but the name is less intuitive.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_io.c

    r87d507b rac3f500  
    2323#ifdef APLOG_USE_MODULE
    2424APLOG_USE_MODULE(gnutls);
     25#endif
     26
     27#if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__)
     28#include <inttypes.h>
    2529#endif
    2630
     
    565569         * small for 32 or 64 bit to matter, but we have to make
    566570         * sure. */
     571#if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__)
     572        if ((apr_size_t) readbytes < len)
     573        {
     574            /* If readbytes is negative the function fails in the
     575             * check above, but the compiler doesn't get that. */
     576            if (__builtin_expect(imaxabs(readbytes) > SIZE_MAX, 0))
     577            {
     578                ap_log_cerror(APLOG_MARK, APLOG_CRIT, APR_EINVAL, ctxt->c,
     579                              "%s: prevented buffer length overflow",
     580                              __func__);
     581                return APR_EINVAL;
     582            }
     583            len = (apr_size_t) readbytes;
     584        }
     585#else
    567586        if ((apr_size_t) readbytes < len
    568587            && __builtin_add_overflow(readbytes, 0, &len))
     
    573592            return APR_EINVAL;
    574593        }
     594#endif
    575595        status =
    576596                gnutls_io_input_read(ctxt, ctxt->input_buffer, &len);
Note: See TracChangeset for help on using the changeset viewer.