librato/safe-name: fix a bug which broke metric name escaping

Invalid characters which were replaced and changed the length of the
string caused safe-name to (sometimes) call subs with a length larger
than the string itself, throwing an exception.