Changeset 1549:19ab8ac08a36 in freeDiameter
- Timestamp:
- Jul 7, 2020, 2:41:54 AM (4 years ago)
- Branch:
- default
- Parents:
- 1548:edfb2b662b91 (diff), 1403:6a35c5470ef4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/messages.c
r1403 r1549 597 597 } 598 598 599 /* Search a given AVP model in a message */600 int fd_msg_search_avp ( struct msg * msg, struct dict_object * what, struct avp ** avp )599 /* Search a given AVP model in a message or AVP */ 600 int fd_msg_search_avp ( msg_or_avp * reference, struct dict_object * what, struct avp ** avp ) 601 601 { 602 602 struct avp * nextavp; … … 604 604 enum dict_object_type dicttype; 605 605 606 TRACE_ENTRY("%p %p %p", msg, what, avp);607 608 CHECK_PARAMS( CHECK_MSG(msg) && what );606 TRACE_ENTRY("%p %p %p", reference, what, avp); 607 608 CHECK_PARAMS( VALIDATE_OBJ(reference) && what ); 609 609 610 610 CHECK_PARAMS( (fd_dict_gettype(what, &dicttype) == 0) && (dicttype == DICT_AVP) ); 611 611 CHECK_FCT( fd_dict_getval(what, &dictdata) ); 612 612 613 /* Loop on all top AVPs */614 CHECK_FCT( fd_msg_browse( msg, MSG_BRW_FIRST_CHILD, (void *)&nextavp, NULL) );613 /* Loop on all top AVPs in message or AVP */ 614 CHECK_FCT( fd_msg_browse(reference, MSG_BRW_FIRST_CHILD, (void *)&nextavp, NULL) ); 615 615 while (nextavp) { 616 616 … … 619 619 break; 620 620 621 /* Otherwise move to next AVP in the message */621 /* Otherwise move to next AVP in the message or AVP */ 622 622 CHECK_FCT( fd_msg_browse(nextavp, MSG_BRW_NEXT, (void *)&nextavp, NULL) ); 623 623 } … … 2247 2247 error_info->pei_errcode = "DIAMETER_INVALID_AVP_VALUE"; 2248 2248 error_info->pei_avp = avp; 2249 s trncpy(error_message, err, sizeof(error_message));2249 snprintf(error_message, sizeof(error_message), "%s", err); 2250 2250 error_info->pei_message = error_message; 2251 2251 } else { … … 2297 2297 if (msg->msg_model != NULL) { 2298 2298 /* Check if this model is still valid for the message data */ 2299 #ifndef NDEBUG 2299 2300 enum dict_object_type dicttype; 2301 #endif 2300 2302 struct dict_cmd_data data; 2301 2303 ASSERT(((fd_dict_gettype(msg->msg_model, &dicttype) == 0) && (dicttype == DICT_COMMAND))); -
libfdproto/messages.c
r1539 r1549 1947 1947 } 1948 1948 1949 /* Check the length is valid */ 1950 if ( avp->avp_public.avp_len < GETAVPHDRSZ(avp->avp_public.avp_flags) ) { 1951 TRACE_DEBUG(INFO, "Invalid AVP size %d", 1952 avp->avp_public.avp_len); 1953 free(avp); 1954 return EBADMSG; 1955 } 1956 1949 1957 /* Check there is enough remaining data in the buffer */ 1950 1958 if ( (avp->avp_public.avp_len > GETAVPHDRSZ(avp->avp_public.avp_flags)) … … 1992 2000 TRACE_DEBUG(INFO, "Truncated message (%zd / %d)", buflen, msglen ); 1993 2001 return EBADMSG; 2002 } 2003 if ( msglen < GETMSGHDRSZ() ) { 2004 TRACE_DEBUG(INFO, "Invalid message length (%d)", msglen ); 2005 return EBADMSG; 1994 2006 } 1995 2007
Note: See TracChangeset
for help on using the changeset viewer.