[Asterisk-cvs] asterisk/channels chan_iax2.c, 1.344, 1.345 iax2-parser.c, 1.50, 1.51 iax2-parser.h, 1.17, 1.18

russell russell
Thu Sep 8 21:07:13 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv9448/channels

Modified Files:
	chan_iax2.c iax2-parser.c iax2-parser.h 
Log Message:
don't use a signed buffer for data that the protocol specifies as unsigned.
This fixes an issues with RSA authentication (issue #5148)


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.344
retrieving revision 1.345
diff -u -d -r1.344 -r1.345
--- chan_iax2.c	7 Sep 2005 23:18:39 -0000	1.344
+++ chan_iax2.c	9 Sep 2005 01:07:25 -0000	1.345
@@ -6132,7 +6132,7 @@
 	int res;
 	int updatehistory=1;
 	int new = NEW_PREVENT;
-	char buf[4096]; 
+	unsigned char buf[4096]; 
 	void *ptr;
 	socklen_t len = sizeof(sin);
 	int dcallno = 0;

Index: iax2-parser.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- iax2-parser.c	2 Sep 2005 19:17:19 -0000	1.50
+++ iax2-parser.c	9 Sep 2005 01:07:25 -0000	1.51
@@ -573,7 +573,7 @@
 	errorf = func;
 }
 
-int iax_parse_ies(struct iax_ies *ies, char *data, int datalen)
+int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
 {
 	/* Parse data into information elements */
 	int len;
@@ -595,28 +595,28 @@
 		}
 		switch(ie) {
 		case IAX_IE_CALLED_NUMBER:
-			ies->called_number = data + 2;
+			ies->called_number = (char *)data + 2;
 			break;
 		case IAX_IE_CALLING_NUMBER:
-			ies->calling_number = data + 2;
+			ies->calling_number = (char *)data + 2;
 			break;
 		case IAX_IE_CALLING_ANI:
-			ies->calling_ani = data + 2;
+			ies->calling_ani = (char *)data + 2;
 			break;
 		case IAX_IE_CALLING_NAME:
-			ies->calling_name = data + 2;
+			ies->calling_name = (char *)data + 2;
 			break;
 		case IAX_IE_CALLED_CONTEXT:
-			ies->called_context = data + 2;
+			ies->called_context = (char *)data + 2;
 			break;
 		case IAX_IE_USERNAME:
-			ies->username = data + 2;
+			ies->username = (char *)data + 2;
 			break;
 		case IAX_IE_PASSWORD:
-			ies->password = data + 2;
+			ies->password = (char *)data + 2;
 			break;
 		case IAX_IE_CODEC_PREFS:
-			ies->codec_prefs = data + 2;
+			ies->codec_prefs = (char *)data + 2;
 			break;
 		case IAX_IE_CAPABILITY:
 			if (len != (int)sizeof(unsigned int)) {
@@ -633,7 +633,7 @@
 				ies->format = ntohl(get_unaligned_uint32(data + 2));
 			break;
 		case IAX_IE_LANGUAGE:
-			ies->language = data + 2;
+			ies->language = (char *)data + 2;
 			break;
 		case IAX_IE_VERSION:
 			if (len != (int)sizeof(unsigned short)) {
@@ -657,10 +657,10 @@
 				ies->samprate = ntohs(get_unaligned_uint16(data + 2));
 			break;
 		case IAX_IE_DNID:
-			ies->dnid = data + 2;
+			ies->dnid = (char *)data + 2;
 			break;
 		case IAX_IE_RDNIS:
-			ies->rdnis = data + 2;
+			ies->rdnis = (char *)data + 2;
 			break;
 		case IAX_IE_AUTHMETHODS:
 			if (len != (int)sizeof(unsigned short))  {
@@ -677,13 +677,13 @@
 				ies->encmethods = ntohs(get_unaligned_uint16(data + 2));
 			break;
 		case IAX_IE_CHALLENGE:
-			ies->challenge = data + 2;
+			ies->challenge = (char *)data + 2;
 			break;
 		case IAX_IE_MD5_RESULT:
-			ies->md5_result = data + 2;
+			ies->md5_result = (char *)data + 2;
 			break;
 		case IAX_IE_RSA_RESULT:
-			ies->rsa_result = data + 2;
+			ies->rsa_result = (char *)data + 2;
 			break;
 		case IAX_IE_APPARENT_ADDR:
 			ies->apparent_addr = ((struct sockaddr_in *)(data + 2));
@@ -710,7 +710,7 @@
 				ies->callno = ntohs(get_unaligned_uint16(data + 2));
 			break;
 		case IAX_IE_CAUSE:
-			ies->cause = data + 2;
+			ies->cause = (char *)data + 2;
 			break;
 		case IAX_IE_CAUSECODE:
 			if (len != 1) {
@@ -763,10 +763,10 @@
 				ies->firmwarever = ntohs(get_unaligned_uint16(data + 2));	
 			break;
 		case IAX_IE_DEVICETYPE:
-			ies->devicetype = data + 2;
+			ies->devicetype = (char *)data + 2;
 			break;
 		case IAX_IE_SERVICEIDENT:
-			ies->serviceident = data + 2;
+			ies->serviceident = (char *)data + 2;
 			break;
 		case IAX_IE_FWBLOCKDESC:
 			if (len != (int)sizeof(unsigned int)) {
@@ -776,11 +776,11 @@
 				ies->fwdesc = ntohl(get_unaligned_uint32(data + 2));
 			break;
 		case IAX_IE_FWBLOCKDATA:
-			ies->fwdata = (unsigned char *)data + 2;
+			ies->fwdata = data + 2;
 			ies->fwdatalen = len;
 			break;
 		case IAX_IE_ENCKEY:
-			ies->enckey = (unsigned char *)data + 2;
+			ies->enckey = data + 2;
 			ies->enckeylen = len;
 			break;
 		case IAX_IE_PROVVER:

Index: iax2-parser.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- iax2-parser.h	2 Sep 2005 19:17:19 -0000	1.17
+++ iax2-parser.h	9 Sep 2005 01:07:25 -0000	1.18
@@ -139,7 +139,7 @@
 extern int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, char *str);
 extern int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat);
 extern int iax_ie_append(struct iax_ie_data *ied, unsigned char ie);
-extern int iax_parse_ies(struct iax_ies *ies, char *data, int datalen);
+extern int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen);
 
 extern int iax_get_frames(void);
 extern int iax_get_iframes(void);




More information about the svn-commits mailing list