Return failing in a windows executable

0

enter image description hereI am using Microsoft Visual Studio to create a utility for firmware upgrade.
I am facing a very perplexing problem here.

printf("Before \n");
if(any_device_active()) 
stat=switchover(ni_handle,&SWover);
else return; <<<<--------Second ONE
printf("switch over stat =%d\n",stat);
Sleep(1000);
return; <<<<<---------Third ONE

As observed the first return is successful.
All the returns after that fail.
I don't seem to get the problem. I don't even know what to look for. Also by the way the switchover function is empty and just returns a 0. any_device_active just returns 0 and prints a list , no problem there. This is the error code the visual debugger throws 0xc0000409.

c
windows
visual-studio-2010
asked on Stack Overflow Apr 26, 2014 by user3171859 • edited Apr 26, 2014 by user3171859

1 Answer

1

0xC0000409 is STATUS_STACK_BUFFER_OVERRUN: It means some write to a pointer overwrote something it shouldn't have on the stack, and the C Run-Time Library's security code in your function's epilog detected it.

You have some kind of buffer overflow bug or improper pointer use in your switchover() function.

answered on Stack Overflow Apr 26, 2014 by Medinoc • edited Apr 26, 2014 by Medinoc

User contributions licensed under CC BY-SA 3.0