Fix potential buffer overflow if `length` (now `length_of_initial_text`) is less than the `strlen` computed length of text. Rename variables to clarify usage. Eliminate the unnecessary use of `strlen`.