On Mon, 08 Oct 2012, rustyBSD wrote:

> Le 07/10/2012 14:58, rustyBSD a ?crit :
> > On 10/07/12 13:41, Theo de Raadt wrote:
> >> If you type "unbound" into google, you will see that
> >> this is upstream code that is incorporated into OpenBSD.
> >>
> >> Therefore, you should really contact that project.
> > Already done
> >
> >
> https://www.nlnetlabs.nl/bugs-script/show_bug.cgi?id=473
> Fixed in trunk.
> 
> Maybe update OpenBSD's code ?

Here's a diff for our tree:

Index: drill/drill_util.c
===================================================================
RCS file: /cvs/src/usr.sbin/unbound/ldns/drill/drill_util.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 drill_util.c
--- drill/drill_util.c  23 Aug 2012 22:28:45 -0000      1.1.1.2
+++ drill/drill_util.c  8 Oct 2012 11:53:27 -0000
@@ -13,7 +13,7 @@
 
 #include <errno.h>
 
-static size_t
+static int
 read_line(FILE *input, char *line, size_t len)
 {
        size_t i;
@@ -71,6 +71,7 @@ read_key_file(const char *filename, ldns
                }
        }
        printf(";; Number of trusted keys: %d\n", key_count);
+       fclose(input_file);
        if (key_count > 0) {
                return LDNS_STATUS_OK;
        } else {
Index: drill/work.c
===================================================================
RCS file: /cvs/src/usr.sbin/unbound/ldns/drill/work.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 work.c
--- drill/work.c        26 Mar 2012 18:08:26 -0000      1.1.1.1
+++ drill/work.c        8 Oct 2012 11:53:27 -0000
@@ -177,21 +177,7 @@ read_hex_buffer(char *filename)
        uint8_t *wire;
        size_t wiresize;
        ldns_buffer *result_buffer = NULL;
-       
-       FILE *fp = NULL;
-       
-       if (strncmp(filename, "-", 2) != 0) {
-               fp = fopen(filename, "r");
-       } else {
-               fp = stdin;
-       }
-       
-       if (fp == NULL) {
-               perror("");
-               warning("Unable to open %s", filename);
-               return NULL;
-       }
-       
+
        wire = xmalloc(LDNS_MAX_PACKETLEN);
        
        wiresize = packetbuffromfile(filename, wire);
@@ -199,7 +185,7 @@ read_hex_buffer(char *filename)
        result_buffer = LDNS_MALLOC(ldns_buffer);
        ldns_buffer_new_frm_data(result_buffer, wire, wiresize);
        ldns_buffer_set_position(result_buffer, 
ldns_buffer_capacity(result_buffer));
-       
+
        xfree(wire);
        return result_buffer;
 }

Reply via email to