You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doing a blind strcpy like you have here is asking for trouble. My guess is that you're overrunning the size of what you have allocated for dest, but without seeing how you're calling this func who knows.
Even if thats not the problem this could benefit from an adjusted API, where you pass in the length of dest to check that you're within range and either return a failure or alloc a new buffer and return that.
You don't show a stack backtrace, and you don't show how that function is called, so there's no way to tell what is going wrong here.
How do you know it's crashing on line 9?
.
the under code works fine in a simple test program, but failed in my project under Ubuntu 14.04,
however success in my mac pro
i debug into my project, it got a "segmentation fault" at line 9
this is the out put:
////
Process 27360 stopped
__GI_raise(sig=6) + 55 at raise.c:56, name = 'xxxxx', stop reason = signal SIGABRT frame #0: 0x00007ffff6ea3c37 libc.so.6
__GI_raise(sig=6) + 55 at raise.c:56////
here is my code:
The text was updated successfully, but these errors were encountered: