Skip to content

Commit 56ce154

Browse files
committed
Fix no gateway case in IPSECKEY RR
1 parent ad75d85 commit 56ce154

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/generic/types.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1524,6 +1524,10 @@ static int32_t parse_ipseckey_rdata(
15241524
return code;
15251525

15261526
switch (octets[1]) {
1527+
case 0: /* no gateway */
1528+
if (token->length != 1 || token->data[0] != '.')
1529+
SYNTAX_ERROR(parser, "Invalid %s in %s", NAME(&fields[3]), NAME(type));
1530+
break;
15271531
case 1: /* IPv4 address */
15281532
type = (const type_info_t *)ipseckey_ipv4;
15291533
fields = type->rdata.fields;
@@ -1536,7 +1540,6 @@ static int32_t parse_ipseckey_rdata(
15361540
if ((code = parse_ip6(parser, type, &fields[3], rdata, token)) < 0)
15371541
return code;
15381542
break;
1539-
case 0: /* no gateway */
15401543
case 3: /* domain name */
15411544
if ((code = parse_name(parser, type, &fields[3], rdata, token)) < 0)
15421545
return code;

tests/types.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,7 @@ static const rdata_t ipseckey_rdata =
402402
0x00,
403403
/* algorithm */
404404
0x02,
405-
/* gateway */
406-
0x00,
405+
/* no gateway */
407406
/* public key */
408407
0x01, 0x03, 0x51, 0x53, 0x79, 0x86, 0xed, 0x35,
409408
0x53, 0x3b, 0x60, 0x64, 0x47, 0x8e, 0xee, 0xb2,

0 commit comments

Comments
 (0)