Fixed buffer overflow for Exercise 2A