8303102: jcmd: ManagementAgent.status truncates the text longer than O_BUFLEN

Reviewed-by: dholmes
This commit is contained in:
Sergey Bylokhov 2023-02-26 23:36:59 +00:00
parent 2fb1e3b7e7
commit a43931b79c
2 changed files with 4 additions and 3 deletions
src/hotspot/share/services
test/jdk/sun/management/jmxremote/startstop

@ -807,7 +807,8 @@ void JMXStatusDCmd::execute(DCmdSource source, TRAPS) {
if (str != nullptr) {
char* out = java_lang_String::as_utf8_string(str);
if (out) {
output()->print_cr("%s", out);
// Avoid using print_cr() because length maybe longer than O_BUFLEN
output()->print_raw_cr(out);
return;
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ import jdk.test.lib.process.ProcessTools;
/**
* @test
* @bug 8023093 8138748 8142398
* @bug 8023093 8138748 8142398 8303102
* @summary Performs a sanity test for the ManagementAgent.status diagnostic command.
* Management agent may be disabled, started (only local connections) and started.
* The test asserts that the expected text is being printed.