[asterisk-commits] trunk r28338 - in /trunk: ./ enum.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu May 18 12:39:39 MST 2006


Author: kpfleming
Date: Thu May 18 14:39:39 2006
New Revision: 28338

URL: http://svn.digium.com/view/asterisk?rev=28338&view=rev
Log:
Merged revisions 28337 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r28337 | kpfleming | 2006-05-18 14:35:55 -0500 (Thu, 18 May 2006) | 2 lines

use unsigned counters for handling answer/IE lengths while processing DNS results (issue #7174)

........

Modified:
    trunk/   (props changed)
    trunk/enum.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: trunk/enum.c
URL: http://svn.digium.com/view/asterisk/trunk/enum.c?rev=28338&r1=28337&r2=28338&view=diff
==============================================================================
--- trunk/enum.c (original)
+++ trunk/enum.c Thu May 18 14:39:39 2006
@@ -95,27 +95,29 @@
 } __attribute__ ((__packed__));
 
 /*! \brief Parse NAPTR record information elements */
-static int parse_ie(unsigned char *data, int maxdatalen, unsigned char *src, int srclen)
-{
-	int len, olen;
-
-	len = olen = (int)src[0];
+static unsigned int parse_ie(char *data, unsigned int maxdatalen, char *src, unsigned int srclen)
+{
+	unsigned int len, olen;
+
+	len = olen = (unsigned int) src[0];
 	src++;
 	srclen--;
-	if (len > srclen || len < 0 ) {
+
+	if (len > srclen) {
 		ast_log(LOG_WARNING, "ENUM parsing failed: Wanted %d characters, got %d\n", len, srclen);
 		return -1;
 	}
+
 	if (len > maxdatalen)
 		len = maxdatalen;
 	memcpy(data, src, len);
+
 	return olen + 1;
 }
 
 /*! \brief Parse DNS NAPTR record used in ENUM ---*/
 static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize, unsigned char *answer, int len, unsigned char *naptrinput)
 {
-
 	char tech_return[80];
 	char *oanswer = answer;
 	char flags[512] = "";



More information about the asterisk-commits mailing list