aboutsummaryrefslogtreecommitdiff
path: root/src/or/cell.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/cell.c')
-rw-r--r--src/or/cell.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/or/cell.c b/src/or/cell.c
new file mode 100644
index 000000000..ef53a9eae
--- /dev/null
+++ b/src/or/cell.c
@@ -0,0 +1,23 @@
+
+#include "or.h"
+
+int check_sane_cell(cell_t *cell) {
+
+ if(!cell)
+ return -1;
+
+ if(cell->aci == 0) {
+ log(LOG_DEBUG,"check_sane_cell(): Cell has aci=0. Dropping.");
+ return -1;
+ }
+
+#if 0 /* actually, the length is sometimes encrypted. so it's ok. */
+ if(cell->length > 120) {
+ log(LOG_DEBUG,"check_sane_cell(): Cell claims to have payload length %d. Dropping.",cell->length);
+ return -1;
+ }
+#endif
+
+ return 0; /* looks good */
+}
+