r9825: Correctly handle length argument to substr()