check for passed in buffer bounds in dfs