Skip to content

Commit 411a5b1

Browse files
committed
vm: Limit size of descriptions
Descriptions longer than about 128KiB will crash the Cockpit session with a protocol error since they are included in the open message for a "spawn" channel. Only use the first 32k (about) when setting them to avoid that. Fixes #1889
1 parent de46d0f commit 411a5b1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libvirtApi/domain.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,11 @@ async function domainSetXML(vm, option, values) {
912912
}
913913

914914
export async function domainSetDescription(vm, description) {
915+
// The description will appear in a "open" message for a "spawn"
916+
// channel, and excessive lengths will crash the session with a
917+
// protocol error. So let's limit it to a reasonable length here.
918+
if (description.length > 32000)
919+
description = description.slice(0, 32000);
915920
await domainSetXML(vm, "metadata", { description });
916921
}
917922

0 commit comments

Comments
 (0)