summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorSander Vrijders <sander@ouroboros.rocks>2019-10-05 13:47:49 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 09:11:20 +0200
commitb06ede91561fbac4a7e29e1569d4855c8f3e2d54 (patch)
tree1731c9ec96727574620bfab9c3859e513f1fbc16 /src/lib
parentc8ab23cbce8a209566f317d22e2c554ff621e3c8 (diff)
downloadouroboros-b06ede91561fbac4a7e29e1569d4855c8f3e2d54.tar.gz
ouroboros-b06ede91561fbac4a7e29e1569d4855c8f3e2d54.zip
lib: Add check that flow_id is valid
In fset_add, the flow_id was passed to the shm_flow_set without checking if it was actually valid. Signed-off-by: Sander Vrijders <sander@ouroboros.rocks> Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 1e0a177d..ee7ae4f1 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -1209,6 +1209,11 @@ int fset_add(struct flow_set * set,
pthread_rwlock_wrlock(&ai.lock);
+ if (ai.flows[fd].flow_id < 0) {
+ pthread_rwlock_unlock(&ai.lock);
+ return -EINVAL;
+ }
+
ret = shm_flow_set_add(ai.fqset, set->idx, ai.flows[fd].flow_id);
packets = shm_rbuff_queued(ai.flows[fd].rx_rb);