Bug 749 - unbound-checkconf gets SIGSEGV when use against a malformatted conf file
unbound-checkconf gets SIGSEGV when use against a malformatted conf file
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
1.5.3
x86_64 FreeBSD
: P5 major
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-24 12:38 CET by vt
Modified: 2016-03-24 13:32 CET (History)
2 users (show)

See Also:


Attachments
A malformatted conf file causing unbound-checkconf to segfault (3.92 KB, text/plain)
2016-03-24 12:38 CET, vt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vt 2016-03-24 12:38:45 CET
Created attachment 324 [details]
A malformatted conf file causing unbound-checkconf to segfault

When I try to check a conf file with unbound-checkconf, it segfaults.
I attached my configuration file so you can see it by yourself.

Seen with version 1.5.3 & 1.5.5 on FreeBSD 9.3 amd64 and with version 1.5.8 on Archlinux amd64.
Comment 1 vt 2016-03-24 12:40:27 CET
See with version 1.5.3 on FreeBSD 9.3 amd64 too.
Comment 2 Wouter Wijngaards 2016-03-24 13:32:25 CET
Hi vt,

Fixed it, the last entry had a NULL name that caused the segfault when it tried to use that.  Added a check for that.

Thank you for the report and the example config file.

If you want one, this is the patch:
Index: iterator/iter_fwd.c
===================================================================
--- iterator/iter_fwd.c	(revision 3695)
+++ iterator/iter_fwd.c	(working copy)
@@ -294,6 +294,7 @@
 	uint8_t* dname;
 	size_t dname_len;
 	for(s = cfg->stubs; s; s = s->next) {
+		if(!s->name) continue;
 		dname = sldns_str2wire_dname(s->name, &dname_len);
 		if(!dname) {
 			log_err("cannot parse stub name '%s'", s->name);

Best regards, Wouter