-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sprintf causes seg fault, when the buffer is defined on the stack #26
Comments
lilith218
changed the title
sprinf causes seg fault, when the buffer is defined on the stack
sprintf causes seg fault, when the buffer is defined on the stack
Oct 6, 2021
Not only sprintf causes seg fault, the following as well
or
|
If I don't declare the array on the stack, the program does not crash. It seems to be related to putting arrays on the stack somehow! #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
char buff[10] = {0}; // no crash
int
main(void)
{
printf("%s", buff);
int x = 10;
sprintf(buff, "%d", x);
x = atoi(buff);
return 0;
} |
Closing, as this is identical to #10. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code causes a segmentation fault in GenMC
version
output
core-dump details
I also don't understand the warning about the implicit declaration of sprinf, since I already included
stdio.h
The text was updated successfully, but these errors were encountered: