Merge ~alfonsosanchezbeato/snappy-hwe-snaps/+git/wifi-ap:dnsmasq/2.75 into ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:dnsmasq/2.75

Proposed by Alfonso Sanchez-Beato on 2019-05-29
Status: Merged
Approved by: Konrad Zapałowicz on 2019-05-29
Approved revision: 25accfdecc8e2ad5001d341e40cce2040859018a
Merged at revision: 59e878ad0bc3a2787d8d4b5f4fed3699212b49b1
Proposed branch: ~alfonsosanchezbeato/snappy-hwe-snaps/+git/wifi-ap:dnsmasq/2.75
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:dnsmasq/2.75
Diff against target: 452 lines (+108/-26)
12 files modified
src/cache.c (+1/-1)
src/dnsmasq.h (+2/-1)
src/dnssec.c (+1/-1)
src/forward.c (+2/-1)
src/network.c (+30/-2)
src/option.c (+1/-1)
src/radv.c (+3/-0)
src/rfc1035.c (+49/-12)
src/rfc2131.c (+3/-3)
src/rfc3315.c (+8/-2)
src/util.c (+6/-1)
trust-anchors.conf (+2/-1)
Reviewer Review Type Date Requested Status
Alfonso Sanchez-Beato continuous-integration Approve on 2019-05-29
System Enablement Bot continuous-integration Needs Fixing on 2019-05-29
Konrad Zapałowicz (community) 2019-05-29 Approve on 2019-05-29
Review via email: mp+368037@code.launchpad.net

Commit message

Update to ubuntu package 2.75-1ubuntu0.16.04.5

Several bug fixes and USNs solved, including 3009-1, 3430-1, and 3716-1.
Changes applied from
http://archive.ubuntu.com/ubuntu/pool/main/d/dnsmasq/dnsmasq_2.75-1ubuntu0.16.04.5.diff.gz

Description of the change

Update to ubuntu package 2.75-1ubuntu0.16.04.5

Several bug fixes and USNs solved, including 3009-1, 3430-1, and 3716-1.
Changes applied from
http://archive.ubuntu.com/ubuntu/pool/main/d/dnsmasq/dnsmasq_2.75-1ubuntu0.16.04.5.diff.gz

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/cache.c b/src/cache.c
index 178d654..1b76b67 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -481,7 +481,7 @@ struct crec *cache_insert(char *name, struct all_addr *addr,
481 existing record is for an A or AAAA and481 existing record is for an A or AAAA and
482 the record we're trying to insert is the same, 482 the record we're trying to insert is the same,
483 just drop the insert, but don't error the whole process. */483 just drop the insert, but don't error the whole process. */
484 if ((flags & (F_IPV4 | F_IPV6)) && (flags & F_FORWARD))484 if ((flags & (F_IPV4 | F_IPV6)) && (flags & F_FORWARD) && addr)
485 {485 {
486 if ((flags & F_IPV4) && (new->flags & F_IPV4) &&486 if ((flags & F_IPV4) && (new->flags & F_IPV4) &&
487 new->addr.addr.addr.addr4.s_addr == addr->addr.addr4.s_addr)487 new->addr.addr.addr.addr4.s_addr == addr->addr.addr4.s_addr)
diff --git a/src/dnsmasq.h b/src/dnsmasq.h
index cf1a782..e021612 100644
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -492,6 +492,7 @@ struct serverfd {
492 int fd;492 int fd;
493 union mysockaddr source_addr;493 union mysockaddr source_addr;
494 char interface[IF_NAMESIZE+1];494 char interface[IF_NAMESIZE+1];
495 unsigned int ifindex, used;
495 struct serverfd *next;496 struct serverfd *next;
496};497};
497498
@@ -1169,7 +1170,7 @@ u32 rand32(void);
1169u64 rand64(void);1170u64 rand64(void);
1170int legal_hostname(char *c);1171int legal_hostname(char *c);
1171char *canonicalise(char *s, int *nomem);1172char *canonicalise(char *s, int *nomem);
1172unsigned char *do_rfc1035_name(unsigned char *p, char *sval);1173unsigned char *do_rfc1035_name(unsigned char *p, char *sval, char *limit);
1173void *safe_malloc(size_t size);1174void *safe_malloc(size_t size);
1174void safe_pipe(int *fd, int read_noblock);1175void safe_pipe(int *fd, int read_noblock);
1175void *whine_malloc(size_t size);1176void *whine_malloc(size_t size);
diff --git a/src/dnssec.c b/src/dnssec.c
index 4deda24..830f304 100644
--- a/src/dnssec.c
+++ b/src/dnssec.c
@@ -2264,7 +2264,7 @@ size_t dnssec_generate_query(struct dns_header *header, char *end, char *name, i
22642264
2265 p = (unsigned char *)(header+1);2265 p = (unsigned char *)(header+1);
2266 2266
2267 p = do_rfc1035_name(p, name);2267 p = do_rfc1035_name(p, name, NULL);
2268 *p++ = 0;2268 *p++ = 0;
2269 PUTSHORT(type, p);2269 PUTSHORT(type, p);
2270 PUTSHORT(class, p);2270 PUTSHORT(class, p);
diff --git a/src/forward.c b/src/forward.c
index 2731b90..959356c 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -810,7 +810,8 @@ void reply_query(int fd, int family, time_t now)
810 we get a good reply from another server. Kill it when we've810 we get a good reply from another server. Kill it when we've
811 had replies from all to avoid filling the forwarding table when811 had replies from all to avoid filling the forwarding table when
812 everything is broken */812 everything is broken */
813 if (forward->forwardall == 0 || --forward->forwardall == 1 || RCODE(header) != SERVFAIL)813 if (forward->forwardall == 0 || --forward->forwardall == 1 ||
814 (RCODE(header) != REFUSED && RCODE(header) != SERVFAIL))
814 {815 {
815 int check_rebind = 0, no_cache_dnssec = 0, cache_secure = 0, bogusanswer = 0;816 int check_rebind = 0, no_cache_dnssec = 0, cache_secure = 0, bogusanswer = 0;
816817
diff --git a/src/network.c b/src/network.c
index a1d90c8..b8ebd55 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1191,6 +1191,7 @@ int local_bind(int fd, union mysockaddr *addr, char *intname, int is_tcp)
1191static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)1191static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)
1192{1192{
1193 struct serverfd *sfd;1193 struct serverfd *sfd;
1194 unsigned int ifindex = 0;
1194 int errsave;1195 int errsave;
11951196
1196 /* when using random ports, servers which would otherwise use1197 /* when using random ports, servers which would otherwise use
@@ -1211,11 +1212,15 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)
1211 return NULL;1212 return NULL;
1212#endif1213#endif
1213 }1214 }
1215
1216 if (intname && strlen(intname) != 0)
1217 ifindex = if_nametoindex(intname); /* index == 0 when not binding to an interface */
1214 1218
1215 /* may have a suitable one already */1219 /* may have a suitable one already */
1216 for (sfd = daemon->sfds; sfd; sfd = sfd->next )1220 for (sfd = daemon->sfds; sfd; sfd = sfd->next )
1217 if (sockaddr_isequal(&sfd->source_addr, addr) &&1221 if (sockaddr_isequal(&sfd->source_addr, addr) &&
1218 strcmp(intname, sfd->interface) == 0)1222 strcmp(intname, sfd->interface) == 0 &&
1223 ifindex == sfd->ifindex)
1219 return sfd;1224 return sfd;
1220 1225
1221 /* need to make a new one. */1226 /* need to make a new one. */
@@ -1237,11 +1242,13 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname)
1237 errno = errsave;1242 errno = errsave;
1238 return NULL;1243 return NULL;
1239 }1244 }
1240 1245
1241 strcpy(sfd->interface, intname); 1246 strcpy(sfd->interface, intname);
1242 sfd->source_addr = *addr;1247 sfd->source_addr = *addr;
1243 sfd->next = daemon->sfds;1248 sfd->next = daemon->sfds;
1249 sfd->ifindex = ifindex;
1244 daemon->sfds = sfd;1250 daemon->sfds = sfd;
1251
1245 return sfd; 1252 return sfd;
1246}1253}
12471254
@@ -1417,12 +1424,16 @@ void check_servers(void)
1417{1424{
1418 struct irec *iface;1425 struct irec *iface;
1419 struct server *serv;1426 struct server *serv;
1427 struct serverfd *sfd, *tmp, **up;
1420 int port = 0;1428 int port = 0;
14211429
1422 /* interface may be new since startup */1430 /* interface may be new since startup */
1423 if (!option_bool(OPT_NOWILD))1431 if (!option_bool(OPT_NOWILD))
1424 enumerate_interfaces(0);1432 enumerate_interfaces(0);
1425 1433
1434 for (sfd = daemon->sfds; sfd; sfd = sfd->next)
1435 sfd->used = 0;
1436
1426 for (serv = daemon->servers; serv; serv = serv->next)1437 for (serv = daemon->servers; serv; serv = serv->next)
1427 {1438 {
1428 if (!(serv->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND)))1439 if (!(serv->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND)))
@@ -1458,6 +1469,9 @@ void check_servers(void)
1458 serv->flags |= SERV_MARK;1469 serv->flags |= SERV_MARK;
1459 continue;1470 continue;
1460 }1471 }
1472
1473 if (serv->sfd)
1474 serv->sfd->used = 1;
1461 }1475 }
1462 1476
1463 if (!(serv->flags & SERV_NO_REBIND) && !(serv->flags & SERV_LITERAL_ADDRESS))1477 if (!(serv->flags & SERV_NO_REBIND) && !(serv->flags & SERV_LITERAL_ADDRESS))
@@ -1490,6 +1504,20 @@ void check_servers(void)
1490 }1504 }
1491 }1505 }
14921506
1507 /* Remove unused sfds */
1508 for (sfd = daemon->sfds, up = &daemon->sfds; sfd; sfd = tmp)
1509 {
1510 tmp = sfd->next;
1511 if (!sfd->used)
1512 {
1513 *up = sfd->next;
1514 close(sfd->fd);
1515 free(sfd);
1516 }
1517 else
1518 up = &sfd->next;
1519 }
1520
1493 cleanup_servers();1521 cleanup_servers();
1494}1522}
14951523
diff --git a/src/option.c b/src/option.c
index ecc2619..ed204fb 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1348,7 +1348,7 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
1348 }1348 }
1349 1349
1350 p = newp;1350 p = newp;
1351 end = do_rfc1035_name(p + len, dom);1351 end = do_rfc1035_name(p + len, dom, NULL);
1352 *end++ = 0;1352 *end++ = 0;
1353 len = end - p;1353 len = end - p;
1354 free(dom);1354 free(dom);
diff --git a/src/radv.c b/src/radv.c
index 39f1e92..9db0095 100644
--- a/src/radv.c
+++ b/src/radv.c
@@ -197,6 +197,9 @@ void icmp6_packet(time_t now)
197 /* look for link-layer address option for logging */197 /* look for link-layer address option for logging */
198 if (sz >= 16 && packet[8] == ICMP6_OPT_SOURCE_MAC && (packet[9] * 8) + 8 <= sz)198 if (sz >= 16 && packet[8] == ICMP6_OPT_SOURCE_MAC && (packet[9] * 8) + 8 <= sz)
199 {199 {
200 if ((packet[9] * 8 - 2) * 3 - 1 >= MAXDNAME) {
201 return;
202 }
200 print_mac(daemon->namebuff, &packet[10], (packet[9] * 8) - 2);203 print_mac(daemon->namebuff, &packet[10], (packet[9] * 8) - 2);
201 mac = daemon->namebuff;204 mac = daemon->namebuff;
202 }205 }
diff --git a/src/rfc1035.c b/src/rfc1035.c
index 56647b0..9456f2a 100644
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -37,7 +37,7 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
37 /* end marker */37 /* end marker */
38 {38 {
39 /* check that there are the correct no of bytes after the name */39 /* check that there are the correct no of bytes after the name */
40 if (!CHECK_LEN(header, p, plen, extrabytes))40 if (!CHECK_LEN(header, p1 ? p1 : p, plen, extrabytes))
41 return 0;41 return 0;
42 42
43 if (isExtract)43 if (isExtract)
@@ -794,6 +794,8 @@ static unsigned char *do_doctor(unsigned char *p, int count, struct dns_header *
794 {794 {
795 unsigned int i, len = *p1;795 unsigned int i, len = *p1;
796 unsigned char *p2 = p1;796 unsigned char *p2 = p1;
797 if ((p1 + len - p) >= rdlen)
798 return 0; /* bad packet */
797 /* make counted string zero-term and sanitise */799 /* make counted string zero-term and sanitise */
798 for (i = 0; i < len; i++)800 for (i = 0; i < len; i++)
799 {801 {
@@ -1362,6 +1364,7 @@ int check_for_ignored_address(struct dns_header *header, size_t qlen, struct bog
1362 return 0;1364 return 0;
1363}1365}
13641366
1367
1365int add_resource_record(struct dns_header *header, char *limit, int *truncp, int nameoffset, unsigned char **pp, 1368int add_resource_record(struct dns_header *header, char *limit, int *truncp, int nameoffset, unsigned char **pp,
1366 unsigned long ttl, int *offset, unsigned short type, unsigned short class, char *format, ...)1369 unsigned long ttl, int *offset, unsigned short type, unsigned short class, char *format, ...)
1367{1370{
@@ -1371,29 +1374,47 @@ int add_resource_record(struct dns_header *header, char *limit, int *truncp, int
1371 unsigned short usval;1374 unsigned short usval;
1372 long lval;1375 long lval;
1373 char *sval;1376 char *sval;
1377#define CHECK_LIMIT(size) \
1378 if (limit && p + (size) > (unsigned char*)limit) \
1379 { \
1380 va_end(ap); \
1381 goto truncated; \
1382 }
13741383
1375 if (truncp && *truncp)1384 if (truncp && *truncp)
1376 return 0;1385 return 0;
1377 1386
1378 va_start(ap, format); /* make ap point to 1st unamed argument */1387 va_start(ap, format); /* make ap point to 1st unamed argument */
1379 1388
1380 if (nameoffset > 0)1389 if (nameoffset > 0)
1381 {1390 {
1391 CHECK_LIMIT(2);
1382 PUTSHORT(nameoffset | 0xc000, p);1392 PUTSHORT(nameoffset | 0xc000, p);
1383 }1393 }
1384 else1394 else
1385 {1395 {
1386 char *name = va_arg(ap, char *);1396 char *name = va_arg(ap, char *);
1387 if (name)1397 if (name && !(p = do_rfc1035_name(p, name, limit)))
1388 p = do_rfc1035_name(p, name);1398 {
1399 va_end(ap);
1400 goto truncated;
1401 }
1402
1389 if (nameoffset < 0)1403 if (nameoffset < 0)
1390 {1404 {
1405 CHECK_LIMIT(2);
1391 PUTSHORT(-nameoffset | 0xc000, p);1406 PUTSHORT(-nameoffset | 0xc000, p);
1392 }1407 }
1393 else1408 else
1394 *p++ = 0;1409 {
1410 CHECK_LIMIT(1);
1411 *p++ = 0;
1412 }
1395 }1413 }
13961414
1415 /* type (2) + class (2) + ttl (4) + rdlen (2) */
1416 CHECK_LIMIT(10);
1417
1397 PUTSHORT(type, p);1418 PUTSHORT(type, p);
1398 PUTSHORT(class, p);1419 PUTSHORT(class, p);
1399 PUTLONG(ttl, p); /* TTL */1420 PUTLONG(ttl, p); /* TTL */
@@ -1406,6 +1427,7 @@ int add_resource_record(struct dns_header *header, char *limit, int *truncp, int
1406 {1427 {
1407#ifdef HAVE_IPV61428#ifdef HAVE_IPV6
1408 case '6':1429 case '6':
1430 CHECK_LIMIT(IN6ADDRSZ);
1409 sval = va_arg(ap, char *); 1431 sval = va_arg(ap, char *);
1410 memcpy(p, sval, IN6ADDRSZ);1432 memcpy(p, sval, IN6ADDRSZ);
1411 p += IN6ADDRSZ;1433 p += IN6ADDRSZ;
@@ -1413,36 +1435,47 @@ int add_resource_record(struct dns_header *header, char *limit, int *truncp, int
1413#endif1435#endif
1414 1436
1415 case '4':1437 case '4':
1438 CHECK_LIMIT(INADDRSZ);
1416 sval = va_arg(ap, char *); 1439 sval = va_arg(ap, char *);
1417 memcpy(p, sval, INADDRSZ);1440 memcpy(p, sval, INADDRSZ);
1418 p += INADDRSZ;1441 p += INADDRSZ;
1419 break;1442 break;
1420 1443
1421 case 'b':1444 case 'b':
1445 CHECK_LIMIT(1);
1422 usval = va_arg(ap, int);1446 usval = va_arg(ap, int);
1423 *p++ = usval;1447 *p++ = usval;
1424 break;1448 break;
1425 1449
1426 case 's':1450 case 's':
1451 CHECK_LIMIT(2);
1427 usval = va_arg(ap, int);1452 usval = va_arg(ap, int);
1428 PUTSHORT(usval, p);1453 PUTSHORT(usval, p);
1429 break;1454 break;
1430 1455
1431 case 'l':1456 case 'l':
1457 CHECK_LIMIT(4);
1432 lval = va_arg(ap, long);1458 lval = va_arg(ap, long);
1433 PUTLONG(lval, p);1459 PUTLONG(lval, p);
1434 break;1460 break;
1435 1461
1436 case 'd':1462 case 'd':
1437 /* get domain-name answer arg and store it in RDATA field */1463 /* get domain-name answer arg and store it in RDATA field */
1438 if (offset)1464 if (offset)
1439 *offset = p - (unsigned char *)header;1465 *offset = p - (unsigned char *)header;
1440 p = do_rfc1035_name(p, va_arg(ap, char *));1466 p = do_rfc1035_name(p, va_arg(ap, char *), limit);
1441 *p++ = 0;1467 if (!p)
1468 {
1469 va_end(ap);
1470 goto truncated;
1471 }
1472 CHECK_LIMIT(1);
1473 *p++ = 0;
1442 break;1474 break;
1443 1475
1444 case 't':1476 case 't':
1445 usval = va_arg(ap, int);1477 usval = va_arg(ap, int);
1478 CHECK_LIMIT(usval);
1446 sval = va_arg(ap, char *);1479 sval = va_arg(ap, char *);
1447 if (usval != 0)1480 if (usval != 0)
1448 memcpy(p, sval, usval);1481 memcpy(p, sval, usval);
@@ -1454,20 +1487,24 @@ int add_resource_record(struct dns_header *header, char *limit, int *truncp, int
1454 usval = sval ? strlen(sval) : 0;1487 usval = sval ? strlen(sval) : 0;
1455 if (usval > 255)1488 if (usval > 255)
1456 usval = 255;1489 usval = 255;
1490 CHECK_LIMIT(usval + 1);
1457 *p++ = (unsigned char)usval;1491 *p++ = (unsigned char)usval;
1458 memcpy(p, sval, usval);1492 memcpy(p, sval, usval);
1459 p += usval;1493 p += usval;
1460 break;1494 break;
1461 }1495 }
14621496
1497#undef CHECK_LIMIT
1463 va_end(ap); /* clean up variable argument pointer */1498 va_end(ap); /* clean up variable argument pointer */
1464 1499
1465 j = p - sav - 2;1500 j = p - sav - 2;
1466 PUTSHORT(j, sav); /* Now, store real RDLength */1501 /* this has already been checked against limit before */
1502 PUTSHORT(j, sav); /* Now, store real RDLength */
1467 1503
1468 /* check for overflow of buffer */1504 /* check for overflow of buffer */
1469 if (limit && ((unsigned char *)limit - p) < 0)1505 if (limit && ((unsigned char *)limit - p) < 0)
1470 {1506 {
1507truncated:
1471 if (truncp)1508 if (truncp)
1472 *truncp = 1;1509 *truncp = 1;
1473 return 0;1510 return 0;
diff --git a/src/rfc2131.c b/src/rfc2131.c
index 9f69ed5..a8ccf86 100644
--- a/src/rfc2131.c
+++ b/src/rfc2131.c
@@ -155,7 +155,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
155 for (offset = 0; offset < (len - 5); offset += elen + 5)155 for (offset = 0; offset < (len - 5); offset += elen + 5)
156 {156 {
157 elen = option_uint(opt, offset + 4 , 1);157 elen = option_uint(opt, offset + 4 , 1);
158 if (option_uint(opt, offset, 4) == BRDBAND_FORUM_IANA)158 if (option_uint(opt, offset, 4) == BRDBAND_FORUM_IANA && offset + elen + 5 <= len)
159 {159 {
160 unsigned char *x = option_ptr(opt, offset + 5);160 unsigned char *x = option_ptr(opt, offset + 5);
161 unsigned char *y = option_ptr(opt, offset + elen + 5);161 unsigned char *y = option_ptr(opt, offset + elen + 5);
@@ -2352,10 +2352,10 @@ static void do_options(struct dhcp_context *context,
23522352
2353 if (fqdn_flags & 0x04)2353 if (fqdn_flags & 0x04)
2354 {2354 {
2355 p = do_rfc1035_name(p, hostname);2355 p = do_rfc1035_name(p, hostname, NULL);
2356 if (domain)2356 if (domain)
2357 {2357 {
2358 p = do_rfc1035_name(p, domain);2358 p = do_rfc1035_name(p, domain, NULL);
2359 *p++ = 0;2359 *p++ = 0;
2360 }2360 }
2361 }2361 }
diff --git a/src/rfc3315.c b/src/rfc3315.c
index 2665d0d..99226a1 100644
--- a/src/rfc3315.c
+++ b/src/rfc3315.c
@@ -206,6 +206,9 @@ static int dhcp6_maybe_relay(struct state *state, void *inbuff, size_t sz,
206 /* RFC-6939 */206 /* RFC-6939 */
207 if ((opt = opt6_find(opts, end, OPTION6_CLIENT_MAC, 3)))207 if ((opt = opt6_find(opts, end, OPTION6_CLIENT_MAC, 3)))
208 {208 {
209 if (opt6_len(opt) - 2 > DHCP_CHADDR_MAX) {
210 return 0;
211 }
209 state->mac_type = opt6_uint(opt, 0, 2);212 state->mac_type = opt6_uint(opt, 0, 2);
210 state->mac_len = opt6_len(opt) - 2;213 state->mac_len = opt6_len(opt) - 2;
211 memcpy(&state->mac[0], opt6_ptr(opt, 2), state->mac_len);214 memcpy(&state->mac[0], opt6_ptr(opt, 2), state->mac_len);
@@ -213,6 +216,9 @@ static int dhcp6_maybe_relay(struct state *state, void *inbuff, size_t sz,
213 216
214 for (opt = opts; opt; opt = opt6_next(opt, end))217 for (opt = opts; opt; opt = opt6_next(opt, end))
215 {218 {
219 if (opt6_ptr(opt, 0) + opt6_len(opt) >= end) {
220 return 0;
221 }
216 int o = new_opt6(opt6_type(opt));222 int o = new_opt6(opt6_type(opt));
217 if (opt6_type(opt) == OPTION6_RELAY_MSG)223 if (opt6_type(opt) == OPTION6_RELAY_MSG)
218 {224 {
@@ -1472,10 +1478,10 @@ static struct dhcp_netid *add_options(struct state *state, int do_refresh)
1472 if ((p = expand(len + 2)))1478 if ((p = expand(len + 2)))
1473 {1479 {
1474 *(p++) = state->fqdn_flags;1480 *(p++) = state->fqdn_flags;
1475 p = do_rfc1035_name(p, state->hostname);1481 p = do_rfc1035_name(p, state->hostname, NULL);
1476 if (state->send_domain)1482 if (state->send_domain)
1477 {1483 {
1478 p = do_rfc1035_name(p, state->send_domain);1484 p = do_rfc1035_name(p, state->send_domain, NULL);
1479 *p = 0;1485 *p = 0;
1480 }1486 }
1481 }1487 }
diff --git a/src/util.c b/src/util.c
index 469eaed..b70ad65 100644
--- a/src/util.c
+++ b/src/util.c
@@ -218,15 +218,20 @@ char *canonicalise(char *in, int *nomem)
218 return ret;218 return ret;
219}219}
220220
221unsigned char *do_rfc1035_name(unsigned char *p, char *sval)221unsigned char *do_rfc1035_name(unsigned char *p, char *sval, char *limit)
222{222{
223 int j;223 int j;
224 224
225 while (sval && *sval)225 while (sval && *sval)
226 {226 {
227 if (limit && p + 1 > (unsigned char*)limit)
228 return p;
229
227 unsigned char *cp = p++;230 unsigned char *cp = p++;
228 for (j = 0; *sval && (*sval != '.'); sval++, j++)231 for (j = 0; *sval && (*sval != '.'); sval++, j++)
229 {232 {
233 if (limit && p + 1 > (unsigned char*)limit)
234 return p;
230#ifdef HAVE_DNSSEC235#ifdef HAVE_DNSSEC
231 if (option_bool(OPT_DNSSEC_VALID) && *sval == NAME_ESCAPE)236 if (option_bool(OPT_DNSSEC_VALID) && *sval == NAME_ESCAPE)
232 *p++ = (*(++sval))-1;237 *p++ = (*(++sval))-1;
diff --git a/trust-anchors.conf b/trust-anchors.conf
index afda518..6f807cf 100644
--- a/trust-anchors.conf
+++ b/trust-anchors.conf
@@ -1,9 +1,10 @@
1# The root DNSSEC trust anchor, valid as at 30/01/20141# The root DNSSEC trust anchor, valid as at 10/02/2017
22
3# Note that this is a DS record (ie a hash of the root Zone Signing Key) 3# Note that this is a DS record (ie a hash of the root Zone Signing Key)
4# If was downloaded from https://data.iana.org/root-anchors/root-anchors.xml4# If was downloaded from https://data.iana.org/root-anchors/root-anchors.xml
55
6trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB56trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
7trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D
78
89
910

Subscribers

People subscribed via source and target branches