comparison libfdproto/messages.c @ 1559:2dbc816d48f4

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.
author Thomas Klausner <wiz@gatalith.at>
date Tue, 27 Oct 2020 10:50:04 +0100
parents 566bb46cc73f
children
comparison
equal deleted inserted replaced
1555:5e29c00d6576 1559:2dbc816d48f4
1774 1774
1775 /* Then we must write the AVP value */ 1775 /* Then we must write the AVP value */
1776 1776
1777 if (avp->avp_model == NULL) { 1777 if (avp->avp_model == NULL) {
1778 /* In the case where we don't know the type of AVP, just copy the raw data or source */ 1778 /* 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 */
1780 1780
1781 if ( avp->avp_rawdata != NULL ) { 1781 if ( avp->avp_rawdata != NULL ) {
1782 /* the content was stored in rawdata */ 1782 /* the content was stored in rawdata */
1783 memcpy(&buffer[*offset], avp->avp_rawdata, avp->avp_rawlen); 1783 memcpy(&buffer[*offset], avp->avp_rawdata, avp->avp_rawlen);
1784 *offset += PAD4(avp->avp_rawlen); 1784 *offset += PAD4(avp->avp_rawlen);
1785 } else { 1785 } else if ( avp->avp_source != NULL ) {
1786 /* the message was not parsed completely */ 1786 /* the message was not parsed completely */
1787 size_t datalen = avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags); 1787 size_t datalen = avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags);
1788 memcpy(&buffer[*offset], avp->avp_source, datalen); 1788 memcpy(&buffer[*offset], avp->avp_source, datalen);
1789 *offset += PAD4(datalen); 1789 *offset += PAD4(datalen);
1790 } 1790 }
"Welcome to our mercurial repository"