Buffer overflow attacks are one of the most notorious software security problems. A few tools have been developed to detect buffer overflow vulnerabilities. In spite of detection capability, most of the existing tools can not generate test cases to trigger the overflow. We propose a new approach that addresses the issue of test case generation for buffer overflow detection. The approach uses search-based structural testing to find test inputs that drive program execution to traverse the desired target where the overflow could occurs. The idea of search-based testing is to formulate the test data generation for a program under test as a search problem. In search-based testing, a data dependence analysis technique called the Chaining Approach can help handle the search failure due to data dependencies. The Chaining Approach is applied to identify the program statements that have influence on whether a buffer accesses is out of bound or not, then abstract paths are derived to lead the program execution toward where a buffer overflow could happen. Based on the Chaining Approach, two optimization techniques are presented to reduce the cost of exercising unnecessary paths. The evaluation results show that our approach can find test data for buffer overflow detection in a more efficient way than using original approach in search-based testing.