Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 675
  • Last Modified:

strcat() -- segmentation fault Core Dumping

0
Deepikak
Asked:
Deepikak
1 Solution
 
muskad202Commented:
the destination string doesn't have enough memory (space) allocated to it..
0
 
brazulewiczCommented:
complete strcat example:

char *buffer;

buffer = (char*) malloc(1024);
memset(buffer, 0, 1024);

strcat(buffer, "initial strcat\n");
strcat(buffer, "another strcat\n");

0
 
plusheyCommented:
You are obviously trying to address some memory that is out of bounds. This can either be because:
1. The target string doesn't have enough free space to concatenate the second string.
2. The target string is not null terminated or has not been initialised.
3. The target string address in not valid.

HTH
0
 
jmcgOwnerCommented:
Nothing has happened on this question in over 9 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by plushey (even though it was late it was most comprehensive).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now