From d24ba6187aebabe39813ded5227516637b708626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigrid=20Solveig=20Hafl=C3=ADnud=C3=B3ttir?= Date: Wed, 20 May 2020 14:07:46 +0200 Subject: [PATCH] fix: walk with 0 elements in path is totally valid --- c9.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c9.c b/c9.c index 71f0465..a8c0b39 100644 --- a/c9.c +++ b/c9.c @@ -277,8 +277,8 @@ c9walk(C9ctx *c, C9tag *tag, C9fid fid, C9fid newfid, const char *path[]) } sz += 2 + len[i]; } - if(path[i] != NULL || i == 0){ - c->error("c9walk: invalid elements !(0 < %u <= %u)", i, C9maxpathel); + if(path[i] != NULL){ + c->error("c9walk: invalid elements !(0 <= %u <= %u)", i, C9maxpathel); return C9Epath; } @@ -497,7 +497,7 @@ c9proc(C9ctx *c) break; case Rwalk: - if(sz < 2+13 || (cnt = r16(&b))*13 > sz-2) + if(sz < 2 || (cnt = r16(&b))*13 > sz-2) goto error; if(cnt > C9maxpathel){ c->error("c9proc: Rwalk !(%u <= %u)", cnt, C9maxpathel); -- 2.45.2