The test_direction_readback fails, because gpio_get_direction wasn't properly null terminating the direction string

I ran the py.test script and I saw that the test_direction_readback test failed on debian wheezy from armhf.com and I found that the gpio_get_direction function didn't null terminate the direction string when it was out because only 3 chars were read from the file and they were o, u, and t and the buffer was uninitialized beyond those 3 chars, so the strcmp failed and returned the gpio as input when in fact it was output. 

I also took the chance to fix other buffer issues in regards to using magic numbers for buffer sizes and the like.