[svn-commits] russell: branch russell/iax2_osp r61693 - /team/russell/iax2_osp/channels/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Apr 20 12:50:49 MST 2007


Author: russell
Date: Fri Apr 20 14:50:48 2007
New Revision: 61693

URL: http://svn.digium.com/view/asterisk?view=rev&rev=61693
Log:
Don't reserve a bunch of space in the iax2_pvt struct unless the osptoken is
acutally present.  Use a string field instead of a fixed buffer.

Modified:
    team/russell/iax2_osp/channels/chan_iax2.c

Modified: team/russell/iax2_osp/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/channels/chan_iax2.c?view=diff&rev=61693&r1=61692&r2=61693
==============================================================================
--- team/russell/iax2_osp/channels/chan_iax2.c (original)
+++ team/russell/iax2_osp/channels/chan_iax2.c Fri Apr 20 14:50:48 2007
@@ -577,6 +577,8 @@
 		AST_STRING_FIELD(accountcode);
 		AST_STRING_FIELD(mohinterpret);
 		AST_STRING_FIELD(mohsuggest);
+		/*! received OSP token */
+		AST_STRING_FIELD(osptoken);
 	);
 	
 	/*! permitted authentication methods */
@@ -634,9 +636,6 @@
 	int frames_dropped;
 	/*! received frame count: (just for stats) */
 	int frames_received;
-
-	/*! received OSP token */
-	char osptoken[IAX_MAX_OSPBUFF_SIZE];
 };
 
 static AST_LIST_HEAD_STATIC(queue, iax_frame);
@@ -6350,7 +6349,7 @@
 {
 	int i;
 	unsigned int length, offset = 0;
-	char* start = iaxs[fr->callno]->osptoken;
+	char full_osptoken[IAX_MAX_OSPBUFF_SIZE];
 
 	for (i = 0; i < IAX_MAX_OSPBLOCK_NUM; i++) {
 		length = ies->ospblocklength[i];
@@ -6360,18 +6359,20 @@
 				offset = 0;
 				break;
 			} else {
-				memcpy(start + offset, ies->osptokenblock[i], length);
+				memcpy(full_osptoken + offset, ies->osptokenblock[i], length);
 				offset += length;
 			}
 		} else {
 			break;
 		}
 	}
-	*(start + offset) = '\0';
-	if (strlen(start) != offset) {
+	*(full_osptoken + offset) = '\0';
+	if (strlen(full_osptoken) != offset) {
 		/* OSP token length wrong, clear buffer */
-		*start = '\0';
-	}
+		*full_osptoken = '\0';
+	}
+
+	ast_string_field_set(iaxs[fr->callno], osptoken, full_osptoken);
 }
 
 static int socket_read(int *id, int fd, short events, void *cbdata)



More information about the svn-commits mailing list