Add maxlen parameter to stringpatch to avoid corrupting binaries with extremely long paths