summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2019-07-26 14:27:13 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2019-07-26 14:27:13 +0200
commitb2708ce81d25ab08e42a4bf8a4a9b0e8c550a44a (patch)
tree33f1ad2fe60e20589d5d82354a688120a4acd077
parent8940f42e1b9251c32e5360575b7d0de03bffb7d2 (diff)
cache: Fix bug of memmove
Change-Id: I75b346ea71a0c3fbc1109cd0aedf9ed7c5ebbce9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/cache.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/cache.c b/src/cache.c
index 5d38b89..299d952 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -92,7 +92,7 @@ drop_at(
e = pos + l;
cache->used -= l;
if (cache->used > e)
- memmove(&cache->content[pos], &cache->content[e], cache->used - e);
+ memmove(&cache->content[pos], &cache->content[e], cache->used - pos);
}
static
@@ -172,13 +172,18 @@ match(
const rcyn_key_t *key
) {
head = cmp(head, key->client);
- if (head)
+ if (head) {
head = cmp(head, key->session);
- if (head)
- head = cmp(head, key->user);
- if (head)
- head = cmpi(head, key->permission);
- return !!head;
+ if (head) {
+ head = cmp(head, key->user);
+ if (head) {
+ head = cmpi(head, key->permission);
+ if (head)
+ return 1;
+ }
+ }
+ }
+ return 0;
}
static