[libpri-commits] branch 1.2 r316 - /branches/1.2/q931.c

libpri-commits at lists.digium.com libpri-commits at lists.digium.com
Fri Feb 17 11:55:06 MST 2006


Author: mattf
Date: Fri Feb 17 12:55:05 2006
New Revision: 316

URL: http://svn.digium.com/view/libpri?rev=316&view=rev
Log:
Backport of 6480

Modified:
    branches/1.2/q931.c

Modified: branches/1.2/q931.c
URL: http://svn.digium.com/view/libpri/branches/1.2/q931.c?rev=316&r1=315&r2=316&view=diff
==============================================================================
--- branches/1.2/q931.c (original)
+++ branches/1.2/q931.c Fri Feb 17 12:55:05 2006
@@ -736,7 +736,7 @@
 
 static void q931_get_number(unsigned char *num, int maxlen, unsigned char *src, int len)
 {
-	if (len > maxlen - 1) {
+	if ((len < 0) || (len > maxlen - 1)) {
 		num[0] = 0;
 		return;
 	}
@@ -780,7 +780,7 @@
 static FUNC_DUMP(dump_calling_party_subaddr)
 {
 	unsigned char cnum[256];
-	q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
+	q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
 	pri_message(pri, "%c Calling Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
 		prefix, len, ie->data[0] >> 7,
 		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
@@ -889,7 +889,7 @@
 static FUNC_RECV(receive_calling_party_subaddr)
 {
 	/* copy digits to call->callingsubaddr */
- 	q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 2, len - 4);
+ 	q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 1, len - 3);
 	return 0;
 }
 



More information about the libpri-commits mailing list