From cd9667d6be072a9c736e49c679b55852f7b30a6c Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 12 Jan 2025 23:08:14 -0700 Subject: lib9p: Don't nul-terminate strings, add some string utils --- lib9p/9p.generated.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib9p/9p.generated.c') diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c index 29fa4a6..dca9f8b 100644 --- a/lib9p/9p.generated.c +++ b/lib9p/9p.generated.c @@ -382,7 +382,7 @@ LM_ALWAYS_INLINE static bool validate_s(struct _validate_ctx *ctx) { if (validate_2(ctx)) return true; uint16_t len = decode_u16le(&ctx->net_bytes[base_offset]); - if (_validate_size_net(ctx, len) || _validate_size_host(ctx, ((size_t)len)+1)) + if (_validate_size_net(ctx, len) || _validate_size_host(ctx, ((size_t)len))) return true; if (!is_valid_utf8_without_nul(&ctx->net_bytes[base_offset+2], len)) return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message contains invalid UTF-8"); @@ -1878,8 +1878,6 @@ LM_ALWAYS_INLINE static void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9 ctx->extra += sizeof(out->utf8[0]) * out->len; for (typeof(out->len) i = 0; i < out->len; i++) unmarshal_1(ctx, (uint8_t *)&out->utf8[i]); - ctx->extra++; - out->utf8[out->len] = '\0'; } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -- cgit v1.2.3-2-g168b