--- a/apps/dtnrespond/dtnrespond.c Thu Oct 13 15:41:53 2011 +0100
+++ b/apps/dtnrespond/dtnrespond.c Tue Oct 18 11:52:07 2011 +0100
@@ -640,8 +640,10 @@
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 ) {
+ fprintf (stderr, "Error decoding BPQ-value-length\n");
return -1;
+ }
i += q_decoding_len;
// BPQ-value n-bytes
@@ -649,20 +651,26 @@
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 ) {
+ fprintf (stderr, "Error decoding number of fragments\n");
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 ) {
+ fprintf (stderr, "Error decoding fragment[%d] offset\n", j);
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 ) {
+ fprintf (stderr, "Error decoding fragment[%d] length\n", j);
return -1;
+ }
i += decoding_len;
}