Fix stack clobbering problem, by passing the argument of the length of
the buffer into the function...

Signed-off-by: Robin Getz <robin.getz@analog.com>