Instantiate $buf before loop to eliminate undefined variable warning

As the title suggests: simply declare $buf before the while loop in order to avoid an undefined variable warning. Some configurations (like my local dev box) may be set to die on such warnings.