diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-02 14:29:52 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-02 14:29:52 -0600 |
commit | 79e6cb0f6f7627284a7614b70a25e976b426d82e (patch) | |
tree | 492b5cacfbb5482b00e023979c0f62f2097a2030 /lib9p/types.c | |
parent | b7a140a42f272aadb5400f013cd21a7a218d26e8 (diff) |
wip bitfield
Diffstat (limited to 'lib9p/types.c')
-rw-r--r-- | lib9p/types.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib9p/types.c b/lib9p/types.c index cb410ea..3505a4a 100644 --- a/lib9p/types.c +++ b/lib9p/types.c @@ -344,7 +344,14 @@ static ALWAYS_INLINE bool validate_s(struct _validate_ctx *ctx) { } static ALWAYS_INLINE bool validate_qt(struct _validate_ctx *ctx) { - return validate_1(ctx); + if (validate_1(ctx)) + return true; + const lib9p_qt_t mask = 0b11111110; + lib9p_qt_t val = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); + if (val & ~mask) + return lib9p_error(ctx->ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#01"PRIx8, + val & ~mask); + return false; } static ALWAYS_INLINE bool validate_qid(struct _validate_ctx *ctx) { |