summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/res_debug.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-06-27 08:22:03 +0000
committerpeter <peter@FreeBSD.org>1997-06-27 08:22:03 +0000
commit63d61ea6e9374a89adcb36c3f5c3b759b9a82c41 (patch)
tree42dba341377c853de43567a145b2a902b2039b15 /lib/libc/net/res_debug.c
parent20250d8619bb0419032ebda7ca41de01e60bea7f (diff)
downloadFreeBSD-src-63d61ea6e9374a89adcb36c3f5c3b759b9a82c41.zip
FreeBSD-src-63d61ea6e9374a89adcb36c3f5c3b759b9a82c41.tar.gz
Merge in bind-4.9.6 resolver changes. Note that they resolve the
overflow problem differently.
Diffstat (limited to 'lib/libc/net/res_debug.c')
-rw-r--r--lib/libc/net/res_debug.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/lib/libc/net/res_debug.c b/lib/libc/net/res_debug.c
index 0d3913e..06b8b42 100644
--- a/lib/libc/net/res_debug.c
+++ b/lib/libc/net/res_debug.c
@@ -77,8 +77,8 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
-static char orig_rcsid[] = "From: Id: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp";
-static char rcsid[] = "$Id$";
+static char orig_rcsid[] = "From: Id: res_debug.c,v 8.20 1997/06/01 20:34:37 vixie Exp";
+static char rcsid[] = "$Id: res_debug.c,v 1.13 1997/02/22 15:00:31 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include "res_config.h"
@@ -1112,40 +1112,47 @@ static u_int8_t
precsize_aton(strptr)
char **strptr;
{
- unsigned int mval = 0, cmval = 0;
u_int8_t retval = 0;
- register char *cp;
- register int exponent;
- register int mantissa;
+ char *cp;
+ int exponent = 0;
+ int mantissa = 0;
cp = *strptr;
+ while (isdigit(*cp)) {
+ if (mantissa == 0)
+ mantissa = *cp - '0';
+ else
+ exponent++;
+ cp++;
+ }
- while (isdigit(*cp))
- mval = mval * 10 + (*cp++ - '0');
-
- if (*cp == '.') { /* centimeters */
+ if (*cp == '.') {
cp++;
if (isdigit(*cp)) {
- cmval = (*cp++ - '0') * 10;
+ if (mantissa == 0)
+ mantissa = *cp - '0';
+ else
+ exponent++;
+ cp++;
+
if (isdigit(*cp)) {
- cmval += (*cp++ - '0');
+ if (mantissa == 0)
+ mantissa = *cp - '0';
+ else
+ exponent++;
+ cp++;
}
+ else
+ exponent++;
}
}
- cmval = (mval * 100) + cmval;
-
- for (exponent = 0; exponent < 9; exponent++)
- if (cmval < poweroften[exponent+1])
- break;
-
- mantissa = cmval / poweroften[exponent];
- if (mantissa > 9)
- mantissa = 9;
+ else
+ exponent += 2;
+ if (mantissa == 0)
+ exponent = 0;
retval = (mantissa << 4) | exponent;
-
*strptr = cp;
-
return (retval);
}
OpenPOWER on IntegriCloud