diff 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
line wrap: on
line diff
--- a/libfdproto/messages.c	Tue Oct 06 21:36:41 2020 +0800
+++ b/libfdproto/messages.c	Tue Oct 27 10:50:04 2020 +0100
@@ -1776,13 +1776,13 @@
 	
 	if (avp->avp_model == NULL) {
 		/* In the case where we don't know the type of AVP, just copy the raw data or source */
-		CHECK_PARAMS( avp->avp_source || avp->avp_rawdata );
+		/* there might be no data if the AVP is empty */
 		
 		if ( avp->avp_rawdata != NULL ) {
 			/* the content was stored in rawdata */
 			memcpy(&buffer[*offset], avp->avp_rawdata, avp->avp_rawlen);
 			*offset += PAD4(avp->avp_rawlen);
-		} else {
+		} else if ( avp->avp_source != NULL ) {
 			/* the message was not parsed completely */
 			size_t datalen = avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags);
 			memcpy(&buffer[*offset], avp->avp_source, datalen);
"Welcome to our mercurial repository"