Navigation


Changeset 752:9e9840ccf059 in freeDiameter for libfdproto/ostr.c


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.