[lttng-dev] Regarding Bug #633 - utils_parse_size_suffix suffers from several problems

Sandeep K Chaudhary babbusandy2006 at gmail.com
Fri Mar 21 03:22:57 EDT 2014


Hi guys,

I checked the fix suggested in the bug description and it is correct.

Changing

ret = regcomp(&regex, "^\\(0x\\)\\{0,1\\}[0-9][0-9]*\\([kKMG]\\{0,1\\}\\)$", 0);

to

ret = regcomp(&regex,
"^(((0x|0X)[0-9A-Fa-f]+)|(0[0-7]*)|([1-9][0-9]*))[kKMG]?$", REG_EXTENDED);

will take care of the following three problems that exist in the first regex


   - It accepts a leading 0 (without a following x or X) to represent an
   octal value, but simultaneously accepts the digits 8 and 9 in said octal
   value (this yields -1).
   - It does not support the leading 0X hexadecimal indicator but does
   support a leading 0x (see following).
   - It accepts a leading 0x to represent an hexadecimal value but rejects
   the a..f and A..F digits in said value.


Please let me know your views, and then I can submit a patch for this.

Thanks and regards,
Sandeep.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140321/9dc72617/attachment.html>


More information about the lttng-dev mailing list