]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorMark Andrews <marka@isc.org>
Wed, 27 Mar 2002 23:52:33 +0000 (23:52 +0000)
committerMark Andrews <marka@isc.org>
Wed, 27 Mar 2002 23:52:33 +0000 (23:52 +0000)
Change 1236 was incorrect.  [RT #2611]

lib/dns/rdata.c

index 0f788f95df7a892bbb77f5383b780cde48cd4244..9fc7b675b7366126d035cac32823c0969aa13451 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rdata.c,v 1.147.2.6 2002/03/20 22:41:58 marka Exp $ */
+/* $Id: rdata.c,v 1.147.2.7 2002/03/27 23:52:33 marka Exp $ */
 
 #include <config.h>
 #include <ctype.h>
@@ -1051,12 +1051,12 @@ dns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source) {
                    strncasecmp("class", source->base, 5) == 0) {
                        char buf[sizeof("65000")];
                        char *endp;
-                       int val;
+                       unsigned int val;
 
-                       strncpy(buf, source->base + 5, sizeof(buf));
-                       buf[sizeof(buf) - 1] = '\0';
-                       val = strtol(buf, &endp, 10);
-                       if (*endp == '\0' && val >= 0 && val <= 0xffff) {
+                       strncpy(buf, source->base + 5, source->length - 5);
+                       buf[source->length - 5] = '\0';
+                       val = strtoul(buf, &endp, 10);
+                       if (*endp == '\0' && val <= 0xffff) {
                                *classp = (dns_rdataclass_t)val;
                                return (ISC_R_SUCCESS);
                        }
@@ -1156,12 +1156,12 @@ dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source) {
            strncasecmp("type", source->base, 4) == 0) {
                char buf[sizeof("65000")];
                char *endp;
-               int val;
+               unsigned int val;
 
-               strncpy(buf, source->base + 4, sizeof(buf));
-               buf[sizeof(buf) - 1] = '\0';
-               val = strtol(buf, &endp, 10);
-               if (*endp == '\0' && val >= 0 && val <= 0xffff) {
+               strncpy(buf, source->base + 4, source->length - 4);
+               buf[source->length - 4] = '\0';
+               val = strtoul(buf, &endp, 10);
+               if (*endp == '\0' && val <= 0xffff) {
                        *typep = (dns_rdatatype_t)val;
                        return (ISC_R_SUCCESS);
                }