The simple things, make search buf null before writing to it. Fixed fucked up input