isc_token_t token;
isc_region_t region;
struct in_addr addr;
- char *e;
+ char *e = NULL;
long proto;
unsigned char bm[8*1024]; /* 64k bits */
long port;
false));
isc_buffer_availableregion(target, ®ion);
- if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1)
+ if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1) {
CHECKTOK(DNS_R_BADDOTTEDQUAD);
- if (region.length < 4)
+ }
+ if (region.length < 4) {
return (ISC_R_NOSPACE);
+ }
memmove(region.base, &addr, 4);
isc_buffer_add(target, 4);
false));
proto = strtol(DNS_AS_STR(token), &e, 10);
- if (*e == 0)
- ;
- else if (!mygetprotobyname(DNS_AS_STR(token), &proto))
+ if (*e != '\0' && !mygetprotobyname(DNS_AS_STR(token), &proto)) {
CHECKTOK(DNS_R_UNKNOWNPROTO);
+ }
- if (proto < 0 || proto > 0xff)
+ if (proto < 0 || proto > 0xff) {
CHECKTOK(ISC_R_RANGE);
+ }
- if (proto == IPPROTO_TCP)
+ if (proto == IPPROTO_TCP) {
ps = "tcp";
- else if (proto == IPPROTO_UDP)
+ } else if (proto == IPPROTO_UDP) {
ps = "udp";
+ }
CHECK(uint8_tobuffer(proto, target));
do {
CHECK(isc_lex_getmastertoken(lexer, &token,
isc_tokentype_string, true));
- if (token.type != isc_tokentype_string)
+ if (token.type != isc_tokentype_string) {
break;
+ }
/*
* Lowercase the service string as some getservbyname() are
service[i] = tolower(service[i]&0xff);
port = strtol(DNS_AS_STR(token), &e, 10);
- if (*e == 0)
- ;
- else if (!mygetservbyname(service, ps, &port) &&
- !mygetservbyname(DNS_AS_STR(token), ps, &port))
+ if (*e != 0 && !mygetservbyname(service, ps, &port) &&
+ !mygetservbyname(DNS_AS_STR(token), ps, &port))
+ {
CHECKTOK(DNS_R_UNKNOWNSERVICE);
- if (port < 0 || port > 0xffff)
+ }
+
+ if (port < 0 || port > 0xffff) {
CHECKTOK(ISC_R_RANGE);
- if (port > maxport)
+ }
+ if (port > maxport) {
maxport = port;
+ }
bm[port / 8] |= (0x80 >> (port % 8));
} while (1);