Relative Content

Tag Archive for cloopsheap-memorybuffer-overflow

Why is there a buffer overflow here

“Works on my machine”, will not work as a leetcode submission due to potential heap buffer overflow. I tried a similar loop outside of the line 7 while loop and it causes no problems. I know there is probably a solution including strstr() but I want to make this implementation work if possible. Leetcode says the problem lies on line 10, please help me alter the code to make it submissable, but also help me understand why this was problematic in the first place if possible. (Question 1071)