diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-02 13:55:08 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-02 13:55:08 -0600 |
commit | b7a140a42f272aadb5400f013cd21a7a218d26e8 (patch) | |
tree | 6770864edd0330704b43d4b2c8f9d8240f691678 /lib9p/srv.c | |
parent | fa7f6a5176a386f8847810f34538d5c0e56f0fb1 (diff) |
wip validate, bitfield
Diffstat (limited to 'lib9p/srv.c')
-rw-r--r-- | lib9p/srv.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib9p/srv.c b/lib9p/srv.c index af713e2..f25fe09 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -136,7 +136,7 @@ COROUTINE lib9p_srv_read_cr(void *_srv) { nonrespond_errorf("accept: %s", strerror(-conn.fd)); continue; } - + struct lib9p_sess sess = { .parent_conn = &conn, .version = 0, @@ -222,7 +222,7 @@ COROUTINE lib9p_srv_write_cr(void *_srv) { lib9p_msg_type_str(typ)); goto write; } - ssize_t host_size = lib9p_unmarshal_size(&req.ctx, net); + ssize_t host_size = lib9p_validate(&req.ctx, net); if (host_size < 0) goto write; if ((size_t)host_size > sizeof(host_req)) { @@ -231,7 +231,7 @@ COROUTINE lib9p_srv_write_cr(void *_srv) { goto write; } lib9p_unmarshal(&req.ctx, net, &typ, &req.tag, host_req); - + /* Handle it. */ switch (typ) { case LIB9P_TYP_Tversion: @@ -307,8 +307,8 @@ static void handle_Tversion(struct lib9p_req *ctx, struct lib9p_msg_Tversion *re enum lib9p_version version = LIB9P_VER_unknown; if (req->version.len >= 6 && - req->version.utf8[0] == '9' && - req->version.utf8[1] == 'P' && + req->version.utf8[0] == '9' && + req->version.utf8[1] == 'P' && '0' <= req->version.utf8[2] && req->version.utf8[2] <= '9' && '0' <= req->version.utf8[3] && req->version.utf8[3] <= '9' && '0' <= req->version.utf8[4] && req->version.utf8[4] <= '9' && |