crypto_pseudo_rand(2, (unsigned char *)&test_aci);
- if(aci_type == ACI_TYPE_LOWER && test_aci >= (2<<15))
- test_aci -= (2<<15);
- if(aci_type == ACI_TYPE_HIGHER && test_aci < (2<<15))
- test_aci += (2<<15);
+ if(aci_type == ACI_TYPE_LOWER && test_aci >= (1<<15))
+ test_aci -= (1<<15);
+ if(aci_type == ACI_TYPE_HIGHER && test_aci < (1<<15))
+ test_aci += (1<<15);
/* if aci_type == ACI_BOTH, don't filter any of it */
if(test_aci == 0)
assert(circ);
+ memset(&sendme, 0, sizeof(cell_t));
sendme.command = CELL_SENDME;
sendme.length = CIRCWINDOW_INCREMENT;
connection_write_cell_to_buf(&cell, conn);
}
+ /* ???? If we might not have added a cell above, why are we
+ * ???? increasing outbuf_flushlen? -NM */
conn->outbuf_flushlen += sizeof(cell_t); /* instruct it to send a cell */
connection_start_writing(conn);
return 0;
}
+ memset(&cell, 0, sizeof(cell_t));
cell.aci = aci;
cell.command = CELL_DESTROY;
log(LOG_INFO,"connection_send_destroy(): Sending destroy (aci %d).",aci);
if(!amount_to_process)
return 0;
+ /* Initialize the cell with 0's */
+ memset(&cell, 0, sizeof(cell_t));
+
if(amount_to_process > CELL_PAYLOAD_SIZE - TOPIC_HEADER_SIZE) {
cell.length = CELL_PAYLOAD_SIZE - TOPIC_HEADER_SIZE;
} else {
return 0;
}
+ memset(&cell, 0, sizeof(cell_t));
*(uint16_t *)(cell.payload+2) = htons(conn->topic_id);
*cell.payload = TOPIC_COMMAND_SENDME;
cell.length += TOPIC_HEADER_SIZE;
} else { /* last cell */
cell.length = dataleft;
memcpy(cell.payload, tmpbuf + tmpbuflen - dataleft, dataleft);
+ /* fill extra space with 0 bytes */
+ memset(cell.payload + dataleft, 0, CELL_PAYLOAD_SIZE - dataleft);
connection_write_cell_to_buf(&cell, n_conn);
dataleft = 0;
}
/* either a full router, or we've got a circuit. send a padding cell. */
// log(LOG_DEBUG,"prepare_for_poll(): Sending keepalive to (%s:%d)",
// tmpconn->address, tmpconn->port);
-// memset(&cell,0,sizeof(cell_t));
+ memset(&cell,0,sizeof(cell_t));
cell.command = CELL_PADDING;
if(connection_write_cell_to_buf(&cell, tmpconn) < 0)
tmpconn->marked_for_close = 1;