Navigation


Changeset 920:cb439d57d0c5 in freeDiameter


Ignore:
Timestamp:
Feb 13, 2013, 2:42:33 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Fix parsing of incoming AVPs with 0-byte length at the end of the message

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/messages.c

    r919 r920  
    16531653                struct avp * avp;
    16541654               
    1655                 if (buflen - offset <= AVPHDRSZ_NOVEND) {
     1655                if (buflen - offset < AVPHDRSZ_NOVEND) {
    16561656                        TRACE_DEBUG(INFO, "truncated buffer: remaining only %d bytes", buflen - offset);
    16571657                        return EBADMSG;
     
    16711671               
    16721672                if (avp->avp_public.avp_flags & AVP_FLAG_VENDOR) {
    1673                         if (buflen - offset <= 4) {
     1673                        if (buflen - offset < 4) {
    16741674                                TRACE_DEBUG(INFO, "truncated buffer: remaining only %d bytes for vendor and data", buflen - offset);
    16751675                                free(avp);
     
    16811681               
    16821682                /* Check there is enough remaining data in the buffer */
    1683                 if (buflen - offset < avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags)) {
     1683                if ( (avp->avp_public.avp_len > GETAVPHDRSZ(avp->avp_public.avp_flags))
     1684                && (buflen - offset < avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags))) {
    16841685                        TRACE_DEBUG(INFO, "truncated buffer: remaining only %d bytes for data, and avp data size is %d",
    16851686                                        buflen - offset,
Note: See TracChangeset for help on using the changeset viewer.