OpenSolaris

Printable Version Enter a New Search
Bug ID 6642734
Synopsis substr() can do the wrong thing for invalid index values
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:dtrace
Keywords
Responsible Engineer Adam Leventhal
Reported Against
Duplicate Of
Introduced In
Commit to Fix snv_88
Fixed In snv_88
Release Fixed solaris_nevada(snv_88)
Related Bugs 6642281
Submit Date 17-December-2007
Last Update Date 23-April-2008
Description
[ahl 12.17.2007]

The DTrace substr() subroutine is meant to mimic the behavior of perl's substr() which it does except if the data is smaller than strsize variable:

# perl -e 'printf("-%s-\n", substr("foobarbaghead", 100, 3));'
--
# dtrace -n BEGIN'{ printf("-%s-", substr("foobarbaghead", 100, 3)); exit(0); }' -q
--
# dtrace -n BEGIN'{ printf("-%s-", substr("foobarbaghead", 100, 3)); exit(0); }' -q -x strsize=10
-ead-
Work Around
N/A
Comments
N/A