Navigation


Changeset 1403:6a35c5470ef4 in freeDiameter for libfdproto


Ignore:
Timestamp:
Jul 7, 2020, 2:24:48 AM (4 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Security fix: check invalid incoming data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/messages.c

    r1327 r1403  
    19471947                }
    19481948               
     1949                /* Check the length is valid */
     1950                if ( avp->avp_public.avp_len < GETAVPHDRSZ(avp->avp_public.avp_flags) ) {
     1951                        TRACE_DEBUG(INFO, "Invalid AVP size %d",
     1952                                        avp->avp_public.avp_len);
     1953                        free(avp);
     1954                        return EBADMSG;
     1955                }
     1956
    19491957                /* Check there is enough remaining data in the buffer */
    19501958                if ( (avp->avp_public.avp_len > GETAVPHDRSZ(avp->avp_public.avp_flags))
     
    19922000                TRACE_DEBUG(INFO, "Truncated message (%zd / %d)", buflen, msglen );
    19932001                return EBADMSG;
     2002        }
     2003        if ( msglen < GETMSGHDRSZ() ) {
     2004                TRACE_DEBUG(INFO, "Invalid message length (%d)", msglen );
     2005                return EBADMSG;
    19942006        }
    19952007       
Note: See TracChangeset for help on using the changeset viewer.