[asterisk-commits] rmudgett: branch rmudgett/misdn_facility r167531 - /team/rmudgett/misdn_facil...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 7 14:05:36 CST 2009


Author: rmudgett
Date: Wed Jan  7 14:05:36 2009
New Revision: 167531

URL: http://svn.digium.com/view/asterisk?view=rev&rev=167531
Log:
Merged from:
https://origsvn.digium.com/svn/asterisk/be/branches/C.2...

..........
r167527 | rmudgett | 2009-01-07 13:31:15 -0600 (Wed, 07 Jan 2009) | 6 lines

channels/misdn/ie.c
*  Removed some unnecessary casts.
channels/misdn/isdn_msg_parser.c
*  Fixed off by one buffer size limits in several functions.
*  Relaxed some restrictions in parse_notify() and build_notify().

Modified:
    team/rmudgett/misdn_facility/channels/misdn/ie.c
    team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c

Modified: team/rmudgett/misdn_facility/channels/misdn/ie.c
URL: http://svn.digium.com/view/asterisk/team/rmudgett/misdn_facility/channels/misdn/ie.c?view=diff&rev=167531&r1=167530&r2=167531
==============================================================================
--- team/rmudgett/misdn_facility/channels/misdn/ie.c (original)
+++ team/rmudgett/misdn_facility/channels/misdn/ie.c Wed Jan  7 14:05:36 2009
@@ -38,11 +38,11 @@
 #define MISDN_IE_DEBG 0
 
 /* support stuff */
-static void strnncpy(char *dest, char *src, int len, int dst_len)
+static void strnncpy(char *dest, const char *src, int len, int dst_len)
 {
 	if (len > dst_len-1)
 		len = dst_len-1;
-	strncpy((char *)dest, (char *)src, len);
+	strncpy(dest, src, len);
 	dest[len] = '\0';
 }
 

Modified: team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c?view=diff&rev=167531&r1=167530&r2=167531
==============================================================================
--- team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c (original)
+++ team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c Wed Jan  7 14:05:36 2009
@@ -393,7 +393,7 @@
 	printf("Parsing SETUP Msg\n"); 
 #endif
 
-	dec_ie_calling_pn(setup->CALLING_PN, qi, &type, &plan, &present, &screen, bc->caller.number, sizeof(bc->caller.number) - 1, nt, bc);
+	dec_ie_calling_pn(setup->CALLING_PN, qi, &type, &plan, &present, &screen, bc->caller.number, sizeof(bc->caller.number), nt, bc);
 	bc->caller.number_type = type; 
 	bc->caller.number_plan = plan;
 	switch (present) {
@@ -416,15 +416,15 @@
 
 	dec_ie_facility(setup->FACILITY, (Q931_info_t *) setup, &bc->fac_in, nt, bc);
 
-	dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *) setup, &type, &plan, bc->dialed.number, sizeof(bc->dialed.number) - 1, nt, bc);
+	dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *) setup, &type, &plan, bc->dialed.number, sizeof(bc->dialed.number), nt, bc);
 	bc->dialed.number_type = type; 
 	bc->dialed.number_plan = plan;
 
-	dec_ie_keypad(setup->KEYPAD, (Q931_info_t *) setup, bc->keypad, sizeof(bc->keypad) - 1, nt, bc);
+	dec_ie_keypad(setup->KEYPAD, (Q931_info_t *) setup, bc->keypad, sizeof(bc->keypad), nt, bc);
 
 	dec_ie_complete(setup->COMPLETE, (Q931_info_t *) setup, &bc->sending_complete, nt, bc);
   
-	dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *) setup, &type, &plan, &present, &screen, &reason, bc->redirecting.from.number, sizeof(bc->redirecting.from.number) - 1, nt, bc);
+	dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *) setup, &type, &plan, &present, &screen, &reason, bc->redirecting.from.number, sizeof(bc->redirecting.from.number), nt, bc);
 	bc->redirecting.from.number_type = type; 
 	bc->redirecting.from.number_plan = plan;
 	switch (present) {
@@ -635,7 +635,7 @@
 	dec_ie_progress(connect->PROGRESS, (Q931_info_t *)connect, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
 
 	dec_ie_connected_pn(connect->CONNECT_PN, (Q931_info_t *) connect, &type, &plan,
-		&pres, &screen, bc->connected.number, sizeof(bc->connected.number) - 1, nt, bc);
+		&pres, &screen, bc->connected.number, sizeof(bc->connected.number), nt, bc);
 	bc->connected.number_type = type;
 	bc->connected.number_plan = plan;
 	switch (pres) {
@@ -1441,9 +1441,8 @@
 		bc->notify_description_code = description_code;
 	}
 
-	number[sizeof(bc->redirecting.to.number) - 1] = 0;
-	dec_ie_redir_dn(notify->NOTIFY, (Q931_info_t *) notify, &type, &plan, &present, number, sizeof(bc->redirecting.to.number) - 1, nt, bc);
-	if (number[0]) {
+	dec_ie_redir_dn(notify->NOTIFY, (Q931_info_t *) notify, &type, &plan, &present, number, sizeof(number), nt, bc);
+	if (0 <= type) {
 		bc->redirecting.to_changed = 1;
 
 		bc->redirecting.to.number_type = type; 
@@ -1481,11 +1480,9 @@
 
 	if (bc->redirecting.to_changed) {
 		bc->redirecting.to_changed = 0;
-		if (bc->redirecting.to.number[0]) {
-			enc_ie_redir_dn(&notify->REDIR_DN, msg, bc->redirecting.to.number_type,
-				bc->redirecting.to.number_plan, bc->redirecting.to.presentation,
-				bc->redirecting.to.number, nt, bc);
-		}
+		enc_ie_redir_dn(&notify->REDIR_DN, msg, bc->redirecting.to.number_type,
+			bc->redirecting.to.number_plan, bc->redirecting.to.presentation,
+			bc->redirecting.to.number, nt, bc);
 	}
 	return msg; 
 }
@@ -1517,8 +1514,8 @@
 	INFORMATION_t *information = (INFORMATION_t *) (msg->data + HEADER_LEN);
 	int type, plan;
 
-	dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *) information, &type, &plan, bc->info_dad, sizeof(bc->info_dad) - 1, nt, bc);
-	dec_ie_keypad(information->KEYPAD, (Q931_info_t *) information, bc->keypad, sizeof(bc->keypad) - 1, nt, bc);
+	dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *) information, &type, &plan, bc->info_dad, sizeof(bc->info_dad), nt, bc);
+	dec_ie_keypad(information->KEYPAD, (Q931_info_t *) information, bc->keypad, sizeof(bc->keypad), nt, bc);
 
 #ifdef DEBUG 
 	printf("Parsing INFORMATION Msg\n"); 




More information about the asterisk-commits mailing list