RFR (XS) : 7131346 Parsing of boolean arguments to diagnostic commands is broken
Frederic Parain
frederic.parain at oracle.com
Thu Jan 19 03:41:06 PST 2012
On 01/19/12 12:25 PM, David Holmes wrote:
+ 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?
str has the right length, but this length has been computed
by the parser which knows what is the delimiter between two
arguments. The section of str which must be considered is not
necessarily NULL-terminated, so using strcasecmp (without
len argument) is not an option.
Example:
str = "-all=true filename.hprof"
len = 4
The comparison must be restricted to the first 4 characters,
even if strlen(str) > 4.
Fred
--
Frederic Parain - Oracle
Grenoble Engineering Center - France
Phone: +33 4 76 18 81 17
Email: Frederic.Parain at Oracle.com
More information about the serviceability-dev
mailing list