Hi Fred,
On 19/01/2012 7:59 PM, Frederic Parain wrote:
This is a small fix (2 lines) to fix an issue with the
parsing of boolean arguments by diagnostic commands
CR is not available on bugs.sun.com yet, but the description
says that the string comparisons to identify "true" or "false"
values doesn't take into account the length of the argument
being parse.
The suggested fix is:
--- old/src/share/vm/services/diagnosticArgument.cpp Thu Jan 19 10:36:10
2012
+++ new/src/share/vm/services/diagnosticArgument.cpp Thu Jan 19 10:36:10
2012
@@ -62,9 +62,9 @@
if (len == 0) {
set_value(true);
} else {
- if (strcasecmp(str, "true") == 0) {
+ if (len == strlen("true") && strncasecmp(str, "true", len) == 0) {
Given you've established that str has the right length isn't the use
strncasecmp unnecessary?
David
-----
set_value(true);
- } else if (strcasecmp(str, "false") == 0) {
+ } else if (len == strlen("false") && strncasecmp(str, "false", len) ==
0) {
set_value(false);
} else {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
Webrev:
http://cr.openjdk.java.net/~fparain/7131346/webrev.00/
Thanks,
Fred