summaryrefslogtreecommitdiff
path: root/lib9p/9p.gen
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/9p.gen')
-rwxr-xr-xlib9p/9p.gen6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib9p/9p.gen b/lib9p/9p.gen
index 4dff97d..83bdcfe 100755
--- a/lib9p/9p.gen
+++ b/lib9p/9p.gen
@@ -697,7 +697,7 @@ static ALWAYS_INLINE bool _validate_list(struct _validate_ctx *ctx,
prev_size = member.static_size
if typ.name == "stat": # SPECIAL
assert typ.members[0].static_size
- ret += f"\n{prefix1}((uint32_t)decode_u{typ.members[0].static_size*8}le(&ctx->net_bytes[size_offset]) != ctx->net_offset - size_offset"
+ ret += f"\n{prefix1}((uint32_t)decode_u{typ.members[0].static_size*8}le(&ctx->net_bytes[size_offset]) != ctx->net_offset - (size_offset+{typ.members[0].static_size})"
ret += f'\n{prefix2}\t? lib9p_error(ctx->ctx, LINUX_EBADMSG, "stat size does not match stat contents")'
ret += f"\n{prefix2}\t: false)"
ret += ";\n"
@@ -874,9 +874,9 @@ static ALWAYS_INLINE bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val) {
prefix = prefix1
if typ.name == "stat": # SPECIAL
assert typ.members[0].static_size
- ret += f"\n{prefix1}((ctx->net_offset - size_offset > UINT16_MAX)"
+ ret += f"\n{prefix1}((ctx->net_offset - (size_offset+{typ.members[0].static_size}) > UINT16_MAX)"
ret += f'\n{prefix2}\t? lib9p_error(ctx->ctx, LINUX_ERANGE, "stat object too large")'
- ret += f"\n{prefix2}\t: ({{ encode_u{typ.members[0].static_size*8}le((uint{typ.members[0].static_size*8}_t)(ctx->net_offset - size_offset), &ctx->net_bytes[size_offset]);"
+ ret += f"\n{prefix2}\t: ({{ encode_u{typ.members[0].static_size*8}le((uint{typ.members[0].static_size*8}_t)(ctx->net_offset - (size_offset+{typ.members[0].static_size})), &ctx->net_bytes[size_offset]);"
ret += f"\n{prefix2} false; }}))"
ret += ";\n"
ret += "}\n"