Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

can you please help me in the organization of stack in unix and linux respectively.

int main()
{
char szbuf1[10]={'\0'};
char szbuf2[5]={'\0'};
char szbuf3[10]={'\0'};
dss_strcpy(szbuf1,"balaraman");
dss_strcpy(szbuf2,"kkkkkkkkkk");
dss_strcpy(szbuf3,"nagarjuna");
fprintf(stderr,"value in szbuf1 is %s\taddress is %p\n",szbuf1,&szbuf1);
fprintf(stderr,"value in szbuf2 is %s\taddress is %p\n",szbuf2,&szbuf2);
fprintf(stderr,"value in szbuf3 is %s\taddress is %p\n",szbuf3,&szbuf3);
return 0;
}

O/p of Unix balaraman kkkkkkkknagarjuna nagarjuna

where as output in linux::

O/p of Linux kkkkk kkkkkkkkkk nagarjuna

........ Thanks in advance

share|improve this question
You need to provide more information, like what Linux version did you test with? I get what you call "unix" output on my Linux machine (but I had to replace your dss_strcpy with the normal strcpy). – Johan Aug 16 '12 at 9:28
1  
It doesn't actually matter which has the more chance. You shouldn't be doing this!! The second you do, all bets are off. – paxdiablo Aug 16 '12 at 10:27
I must be missing what the question is? You basically created a buffer overflow in both cases. – Karlson Aug 16 '12 at 14:39
i think you have a segmentation fault with your code. – Mohsen Pahlevanzadeh Aug 16 '12 at 19:21
1  
Programming questions are off-topic here. Stack Overflow is a site for programming questions. But do not repost this question as is, it is missing several necessary parts. Which variant of unix? What compiler? With what options? This is extremely implementation-dependent. – Gilles Aug 16 '12 at 23:05

closed as not a real question by Ulrich Dangel, Gilles, Stéphane Gimenez, Renan, jasonwryan Aug 19 '12 at 21:05

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

Browse other questions tagged or ask your own question.