Add length() to spec and fix inaccuracy regarding NULL
Share offset/length preparation between methods