From dc45def8ec165dbae5781ab581b9d04ebfe10d39 Mon Sep 17 00:00:00 2001 From: Viktor Erlingsson Date: Mon, 12 Feb 2024 11:36:01 +0100 Subject: [PATCH] bytesize --- src/lavinmq/http/controller/vhosts.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lavinmq/http/controller/vhosts.cr b/src/lavinmq/http/controller/vhosts.cr index e84a809f62..0b0b1e9a2d 100644 --- a/src/lavinmq/http/controller/vhosts.cr +++ b/src/lavinmq/http/controller/vhosts.cr @@ -34,7 +34,7 @@ module LavinMQ refuse_unless_administrator(context, u) name = URI.decode_www_form(params["name"]) is_update = @amqp_server.vhosts[name]? - if name.size > 255 + if name.bytesize > UInt8::MAX bad_request(context, "Vhost name too long, can't exceed 255 characters") end @amqp_server.vhosts.create(name, u)