Speklap:
while (pos < max_len - 1)pos last position is max_len - 2. It doenst go to the last position in buffer[max_len]
That was it!
I changed it to
while (pos < max_len)
Speklap:
while (pos < max_len - 1)pos last position is max_len - 2. It doenst go to the last position in buffer[max_len]
That was it!
I changed it to
while (pos < max_len)