Changes in libfdproto/messages.c [924:877592751fee:903:4382d7420e65] in freeDiameter
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/messages.c
r924 r903 106 106 #define _A(_x) ((struct avp *)(_x)) 107 107 /* Check the type and eyecatcher */ 108 #define CHECK_AVP(_x) ((_ x) && (_C(_x)->type == MSG_AVP) && (_A(_x)->avp_eyec == MSG_AVP_EYEC))108 #define CHECK_AVP(_x) ((_C(_x)->type == MSG_AVP) && (_A(_x)->avp_eyec == MSG_AVP_EYEC)) 109 109 110 110 /* The following structure represents an instance of a message (command and children AVPs). */ … … 239 239 if (new->avp_rawlen) { 240 240 CHECK_MALLOC( new->avp_rawdata = malloc(new->avp_rawlen) ); 241 memset(new->avp_rawdata, 0x 00, new->avp_rawlen);241 memset(new->avp_rawdata, 0xFF, new->avp_rawlen); 242 242 } 243 243 } … … 1216 1216 } 1217 1217 1218 /* Associate a session with a message, use only when the session was just created */1219 int fd_msg_sess_set(struct msg * msg, struct session * session)1220 {1221 TRACE_ENTRY("%p %p", msg, session);1222 1223 /* Check we received valid parameters */1224 CHECK_PARAMS( CHECK_MSG(msg) );1225 CHECK_PARAMS( session );1226 CHECK_PARAMS( msg->msg_sess == NULL );1227 1228 msg->msg_sess = session;1229 return 0;1230 }1231 1232 1218 1233 1219 /* Retrieve the session of the message */ … … 1275 1261 1276 1262 /* Resolve the session and we are done */ 1277 if (avp->avp_public.avp_value->os.len > 0) { 1278 CHECK_FCT( fd_sess_fromsid_msg ( avp->avp_public.avp_value->os.data, avp->avp_public.avp_value->os.len, &msg->msg_sess, new) ); 1279 *session = msg->msg_sess; 1280 } else { 1281 TRACE_DEBUG(FULL, "Session-Id AVP with 0-byte length found in message %p", msg); 1282 *session = NULL; 1283 } 1263 CHECK_FCT( fd_sess_fromsid_msg ( avp->avp_public.avp_value->os.data, avp->avp_public.avp_value->os.len, &msg->msg_sess, new) ); 1264 *session = msg->msg_sess; 1284 1265 1285 1266 return 0; … … 1667 1648 struct avp * avp; 1668 1649 1669 if (buflen - offset < AVPHDRSZ_NOVEND) {1650 if (buflen - offset <= AVPHDRSZ_NOVEND) { 1670 1651 TRACE_DEBUG(INFO, "truncated buffer: remaining only %d bytes", buflen - offset); 1671 1652 return EBADMSG; … … 1685 1666 1686 1667 if (avp->avp_public.avp_flags & AVP_FLAG_VENDOR) { 1687 if (buflen - offset < 4) {1668 if (buflen - offset <= 4) { 1688 1669 TRACE_DEBUG(INFO, "truncated buffer: remaining only %d bytes for vendor and data", buflen - offset); 1689 1670 free(avp); … … 1695 1676 1696 1677 /* Check there is enough remaining data in the buffer */ 1697 if ( (avp->avp_public.avp_len > GETAVPHDRSZ(avp->avp_public.avp_flags)) 1698 && (buflen - offset < avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags))) { 1678 if (buflen - offset < avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags)) { 1699 1679 TRACE_DEBUG(INFO, "truncated buffer: remaining only %d bytes for data, and avp data size is %d", 1700 1680 buflen - offset,
Note: See TracChangeset
for help on using the changeset viewer.