From 1958d9fbd5de593738f9d4264498726e7dfac9d8 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Wed, 15 Aug 2018 09:26:13 +0000 Subject: [PATCH] - Fix segfault in auth-zone read and reorder of RRSIGs. git-svn-id: file:///svn/unbound/trunk@4853 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 3 +++ services/authzone.c | 3 ++- testcode/unitauth.c | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 60458c612..1be8ddf95 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +15 August 2018: Wouter + - Fix segfault in auth-zone read and reorder of RRSIGs. + 14 August 2018: Wouter - Fix that printout of error for cycle targets is a verbosity 4 printout and does not wrongly print it is a memory error. diff --git a/services/authzone.c b/services/authzone.c index b9576eaae..e8c99077d 100644 --- a/services/authzone.c +++ b/services/authzone.c @@ -1014,7 +1014,8 @@ rrset_moveover_rrsigs(struct auth_data* node, uint16_t rr_type, } /* copy base values */ memcpy(sigd, sigold, sizeof(struct packed_rrset_data)); - sigd->rrsig_count -= sigs; + /* in sigd the RRSIGs are stored in the base of the RR, in count */ + sigd->count -= sigs; /* setup rr_len */ sigd->rr_len = (size_t*)((uint8_t*)sigd + sizeof(struct packed_rrset_data)); diff --git a/testcode/unitauth.c b/testcode/unitauth.c index 4b538ef62..19d3c4f67 100644 --- a/testcode/unitauth.c +++ b/testcode/unitauth.c @@ -131,6 +131,12 @@ static const char* zone_example_com = "z9.example.com. 3600 IN A 10.0.0.10\n" "z9.example.com. 3600 IN RRSIG A 8 3 10200 20170612005010 20170515005010 42393 nlnetlabs.nl. NhEDrHkuIgHkjWhDRVsGOIJWZpSs+QdduilWFe5d+/ZhOheLJbaTYD5w6+ZZ3yPh1tNud+jlg+GyiOSVapLEO31swDCIarL1UfRjRSpxxDCHGag5Zu+S4hF+KURxO3cJk8jLBELMQyRuMRHoKrw/wsiLGVu1YpAyAPPMcjFBNbk=\n" "z9.example.com. 3600 IN RRSIG A 8 3 10200 20170612005010 20170515005010 42393 nlnetlabs.nl. NhEDrHkuIgHkjWhDRVsGOIJWZpSs+QdduilWFe5d+/ZhOheLJbaTYD5w6+ZZ3yPh1tNud+jlg+GyiOSVapLEO31swDCIarL1UfRjRSpxxDCHGag5Zu+S4hF+KURxO3cJk8jLBELMQyRuMRHoKrw/wsiLGVu1YpAyAPPMcjFBNbk=\n" +/* different covered types, first RRSIGs then, RRs, then another RRSIG */ +"z10.example.com. 3600 IN RRSIG AAAA 8 3 10200 20170612005010 20170515005010 42393 nlnetlabs.nl. NhEDrHkuIgHkjWhDRVsGOIJWZpSs+QdduilWFe5d+/ZhOheLJbaTYD5w6+ZZ3yPh1tNud+jlg+GyiOSVapLEO31swDCIarL1UfRjRSpxxDCHGag5Zu+S4hF+KURxO3cJk8jLBELMQyRuMRHoKrw/wsiLGVu1YpAyAPPMcjFBNbk=\n" +"z10.example.com. 3600 IN RRSIG A 8 3 10200 20170612005010 20170515005010 42393 nlnetlabs.nl. NhEDrHkuIgHkjWhDRVsGOIJWZpSs+QdduilWFe5d+/ZhOheLJbaTYD5w6+ZZ3yPh1tNud+jlg+GyiOSVapLEO31swDCIarL1UfRjRSpxxDCHGag5Zu+S4hF+KURxO3cJk8jLBELMQyRuMRHoKrw/wsiLGVu1YpAyAPPMcjFBNbk=\n" +"z10.example.com. 3600 IN A 10.0.0.10\n" +"z10.example.com. 3600 IN RRSIG CNAME 8 3 10200 20170612005010 20170515005010 42393 nlnetlabs.nl. NhEDrHkuIgHkjWhDRVsGOIJWZpSs+QdduilWFe5d+/ZhOheLJbaTYD5w6+ZZ3yPh1tNud+jlg+GyiOSVapLEO31swDCIarL1UfRjRSpxxDCHGag5Zu+S4hF+KURxO3cJk8jLBELMQyRuMRHoKrw/wsiLGVu1YpAyAPPMcjFBNbk=\n" +"z10.example.com. 3600 IN AAAA ::11\n" #endif /* if0 for duplicates and reordering */ ; @@ -554,7 +560,7 @@ checkfile(char* f1, char *f2) log_info("in files %s and %s:%d", f1, f2, line); log_info("'%s'", buf1); log_info("'%s'", buf2); - fatal_exit("files are not eqaul"); + fatal_exit("files are not equal"); } } unit_assert(feof(i1) && feof(i2));