diff --git a/bin/check/named-checkzone.c b/bin/check/named-checkzone.c index 9a15eec34e..40b4eabd1f 100644 --- a/bin/check/named-checkzone.c +++ b/bin/check/named-checkzone.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -107,7 +108,6 @@ main(int argc, char **argv) { bool snset = false; bool logdump = false; FILE *errout = stdout; - char *endp; outputstyle = &dns_master_style_full; @@ -222,22 +222,23 @@ main(int argc, char **argv) { case 'L': snset = true; - endp = NULL; - serialnum = strtol(isc_commandline_argument, &endp, 0); - if (*endp != '\0') { - fprintf(stderr, "source serial number " - "must be numeric"); + if (isc_parse_uint32(&serialnum, + isc_commandline_argument, + 0) != ISC_R_SUCCESS) + { + fprintf(stderr, "source serial number must be " + "a 32-bit unsigned integer\n"); exit(EXIT_FAILURE); } break; case 'l': zone_options |= DNS_ZONEOPT_CHECKTTL; - endp = NULL; - maxttl = strtol(isc_commandline_argument, &endp, 0); - if (*endp != '\0') { - fprintf(stderr, "maximum TTL " - "must be numeric"); + if (isc_parse_uint32(&maxttl, isc_commandline_argument, + 0) != ISC_R_SUCCESS) + { + fprintf(stderr, "maximum TTL must be a 32-bit " + "unsigned integer\n"); exit(EXIT_FAILURE); } break;