diff libfdcore/p_ce.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/libfdcore/p_ce.c	Tue Oct 06 21:36:41 2020 +0800
+++ b/libfdcore/p_ce.c	Tue Oct 27 10:50:04 2020 +0100
@@ -336,6 +336,14 @@
 					return EINVAL;
 				}
 				
+				/* Origin-Realm is empty */
+				if (hdr->avp_value->os.len == 0) {
+					error->pei_errcode = "DIAMETER_INVALID_AVP_VALUE";
+					error->pei_message = "Your Origin-Realm is empty.";
+					error->pei_avp = avp;
+					return EINVAL;
+				}
+
 				/* Save the value */
 				CHECK_MALLOC(  peer->p_hdr.info.runtime.pir_realm = os0dup( hdr->avp_value->os.data, hdr->avp_value->os.len )  );
 				peer->p_hdr.info.runtime.pir_realmlen = hdr->avp_value->os.len;
"Welcome to our mercurial repository"