From 79e6cb0f6f7627284a7614b70a25e976b426d82e Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Wed, 2 Oct 2024 14:29:52 -0600 Subject: wip bitfield --- lib9p/types.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib9p/types.c') 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) { -- cgit v1.2.3-2-g168b