Navigation


Changeset 752:9e9840ccf059 in freeDiameter


Ignore:
Timestamp:
Sep 24, 2011, 4:45:14 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Attempt to handle more gracefully (invalid) AVPs that contain an empty octetstring

Location:
libfdproto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/messages.c

    r740 r752  
    17711771                                } );
    17721772                        avp->avp_storage.os.len = avp->avp_public.avp_len - GETAVPHDRSZ( avp->avp_public.avp_flags );
    1773                         if (avp->avp_storage.os.len) {
    1774                                 CHECK_MALLOC(  avp->avp_storage.os.data = os0dup(avp->avp_source, avp->avp_storage.os.len)  );
    1775                                 avp->avp_mustfreeos = 1;
    1776                         } else {
    1777                                 avp->avp_storage.os.data = NULL;
    1778                         }
     1773                        CHECK_MALLOC(  avp->avp_storage.os.data = os0dup(avp->avp_source, avp->avp_storage.os.len)  );
     1774                        avp->avp_mustfreeos = 1;
    17791775                        break;
    17801776               
  • libfdproto/ostr.c

    r743 r752  
    4545        os0_t r;
    4646        CHECK_MALLOC_DO( r = malloc(l+1), return NULL );
    47         memcpy(r, s, l); /* this might be faster than a strcpy or strdup because it can work with 32 or 64b blocks */
     47        if (l)
     48                memcpy(r, s, l); /* this might be faster than a strcpy or strdup because it can work with 32 or 64b blocks */
    4849        r[l] = '\0';
    4950        return r;
     
    5859        if (os1sz > os2sz)
    5960                return 1;
    60         return memcmp(os1, os2, os1sz);
     61        return os1sz ? memcmp(os1, os2, os1sz) : 0;
    6162}
    6263
Note: See TracChangeset for help on using the changeset viewer.