Adding a dummy char to ensure rled_len is always even
Adjusted the length in while condition

length - 1 is for manually edited file reading.

Note: rled_len should be even so that we can make the cases simple while
decoding. Now, we shall get at least the length of next transfer at the buffer end.