Navigation


Changeset 1559:2dbc816d48f4 in freeDiameter


Ignore:
Timestamp:
Oct 27, 2020, 6:50:04 PM (3 years ago)
Author:
Thomas Klausner <wiz@gatalith.at>
Branch:
default
Phase:
public
Message:

Fail when a peer with empty Origin-Realm tries to connect.

Empty Origin-Realms cause problems in the routing code later.

Reduce warnings when reporting an empty Failed-AVP;
both avp_source and avp_rawdata are NULL in this case.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/p_ce.c

    r1554 r1559  
    337337                                }
    338338                               
     339                                /* Origin-Realm is empty */
     340                                if (hdr->avp_value->os.len == 0) {
     341                                        error->pei_errcode = "DIAMETER_INVALID_AVP_VALUE";
     342                                        error->pei_message = "Your Origin-Realm is empty.";
     343                                        error->pei_avp = avp;
     344                                        return EINVAL;
     345                                }
     346
    339347                                /* Save the value */
    340348                                CHECK_MALLOC(  peer->p_hdr.info.runtime.pir_realm = os0dup( hdr->avp_value->os.data, hdr->avp_value->os.len )  );
  • libfdproto/messages.c

    r1554 r1559  
    17771777        if (avp->avp_model == NULL) {
    17781778                /* In the case where we don't know the type of AVP, just copy the raw data or source */
    1779                 CHECK_PARAMS( avp->avp_source || avp->avp_rawdata );
     1779                /* there might be no data if the AVP is empty */
    17801780               
    17811781                if ( avp->avp_rawdata != NULL ) {
     
    17831783                        memcpy(&buffer[*offset], avp->avp_rawdata, avp->avp_rawlen);
    17841784                        *offset += PAD4(avp->avp_rawlen);
    1785                 } else {
     1785                } else if ( avp->avp_source != NULL ) {
    17861786                        /* the message was not parsed completely */
    17871787                        size_t datalen = avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags);
Note: See TracChangeset for help on using the changeset viewer.