static isc_result_t
reverse_octets(const char *in, char **p, char *end) {
- char *dot = strchr(in, '.');
+ const char *dot = strchr(in, '.');
int len;
if (dot != NULL) {
RETERR(reverse_octets(dot + 1, p, end));
dash_option(const char *option, char *next, struct query *query, bool global,
bool *setname) {
char opt;
- const char *value;
+ const char *value, *oldvalue;
isc_result_t result;
bool value_from_next;
isc_consttextregion_t tr;
struct in_addr in4;
struct in6_addr in6;
in_port_t srcport;
- char *hash;
+ const char *hash;
uint32_t num;
while (strpbrk(option, single_dash_opts) == &option[0]) {
case 'b':
GLOBAL();
hash = strchr(value, '#');
+ oldvalue = value;
if (hash != NULL) {
result = parse_uint(&num, hash + 1, MAXPORT,
"port number");
CHECKM("parse_uint(srcport)", result);
srcport = num;
- *hash = '\0';
+ snprintf(textname, sizeof(textname), "%.*s",
+ (int)(hash - value), value);
+ value = textname;
} else {
srcport = 0;
}
isc_sockaddr_fromin(&srcaddr, &in4, srcport);
isc_net_disableipv6();
} else {
- if (hash != NULL) {
- *hash = '#';
- }
- fatal("invalid address %s", value);
- }
- if (hash != NULL) {
- *hash = '#';
+ fatal("invalid address %s", oldvalue);
}
have_src = true;
return value_from_next;