Fixed segfault in query logging
authoraidan
Thu, 09 Jun 2011 10:57:40 +0100
changeset 9 b72ba16e5586
parent 8 ce3cb8a86959
child 10 84c85b6450de
Fixed segfault in query logging
apps/dtnquery/dtnquery.c
--- a/apps/dtnquery/dtnquery.c	Tue May 31 18:20:22 2011 +0100
+++ b/apps/dtnquery/dtnquery.c	Thu Jun 09 10:57:40 2011 +0100
@@ -690,7 +690,7 @@
     if (i<buf_len) bpq->matching_rule = (u_int) buf[i++];
 
     // BPQ-value-length     SDNV
-    if ( (q_decoding_len = sdnv_decode (buf[i], buf_len - i, &(bpq->query.query_len))) == -1 )
+    if ( (q_decoding_len = sdnv_decode (&(buf[i]), buf_len - i, &(bpq->query.query_len))) == -1 )
         return -1;
     i += q_decoding_len;
 
@@ -699,19 +699,19 @@
     i += bpq->query.query_len;
 
     // number of fragments  SDNV
-    if ( (f_decoding_len = sdnv_decode (buf[i], buf_len - i, &(bpq->fragments.num_frag_returned))) == -1 )
+    if ( (f_decoding_len = sdnv_decode (&(buf[i]), buf_len - i, &(bpq->fragments.num_frag_returned))) == -1 )
         return -1;
     i += f_decoding_len;
 
     for (j=0; i<buf_len && j<bpq->fragments.num_frag_returned; ++j) {
 
         // fragment offsets     SDNV
-        if ( (decoding_len = sdnv_decode (buf[i], buf_len - i, &(bpq->fragments.frag_offsets[j]))) == -1 )
+        if ( (decoding_len = sdnv_decode (&(buf[i]), buf_len - i, &(bpq->fragments.frag_offsets[j]))) == -1 )
             return -1;
         i += decoding_len;
 
         // fragment lengths     SDNV
-        if ( (decoding_len = sdnv_decode (buf[i], buf_len - i, &(bpq->fragments.frag_lenghts[j]))) == -1 )
+        if ( (decoding_len = sdnv_decode (&(buf[i]), buf_len - i, &(bpq->fragments.frag_lenghts[j]))) == -1 )
             return -1;
         i += decoding_len;
     }