summaryrefslogtreecommitdiff
path: root/lib9p/9p.generated.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-08 12:08:39 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-08 12:08:59 -0600
commit2e1ce75974945e6acc5178b4d811740e52e83d6e (patch)
tree12fd2d4a3c10ad116ae854e8b677289de5a32b29 /lib9p/9p.generated.c
parenta7a64e15987ddbb7feae6cf2ff1aaaeb71dbed82 (diff)
lib9p: fix stat size
It does NOT include the u16 size field itself.
Diffstat (limited to 'lib9p/9p.generated.c')
-rw-r--r--lib9p/9p.generated.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c
index 1fef571..b2243e2 100644
--- a/lib9p/9p.generated.c
+++ b/lib9p/9p.generated.c
@@ -400,7 +400,7 @@ static ALWAYS_INLINE bool validate_stat(struct _validate_ctx *ctx) {
|| ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
|| ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
|| ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
- || ((uint32_t)decode_u16le(&ctx->net_bytes[size_offset]) != ctx->net_offset - size_offset
+ || ((uint32_t)decode_u16le(&ctx->net_bytes[size_offset]) != ctx->net_offset - (size_offset+2)
? lib9p_error(ctx->ctx, LINUX_EBADMSG, "stat size does not match stat contents")
: false);
}
@@ -965,9 +965,9 @@ static ALWAYS_INLINE bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_st
|| ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->file_owner_n_uid) )
|| ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->file_owner_n_gid) )
|| ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->file_last_modified_n_uid) )
- || ((ctx->net_offset - size_offset > UINT16_MAX)
+ || ((ctx->net_offset - (size_offset+2) > UINT16_MAX)
? lib9p_error(ctx->ctx, LINUX_ERANGE, "stat object too large")
- : ({ encode_u16le((uint16_t)(ctx->net_offset - size_offset), &ctx->net_bytes[size_offset]);
+ : ({ encode_u16le((uint16_t)(ctx->net_offset - (size_offset+2)), &ctx->net_bytes[size_offset]);
false; }));
}