how big can be an array to give segmentation fault!!!
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
it compiled fine but gave segmentation fault while executing ... which in other words means (at least to me... as i am not quite familiar with C/Linux ), the total combined size of all the arrays should not cross 10MB (it worked fine with "char s[8*1024000];" declaration).
Would you guys please tell me how this could be increased or decreased and/or how this is determined that what should be the combined array sized if all the arrays are initialized in the same function. My system is pentium III with 256MB RAM and I am working on RH 9.0.
hi...
i tried to do something like that... but could not get any success...
anyway would you please tell me what this stack and heap is all about, and how to use them. I really have no idea what they are and how they can be used in C.
I am a C newbie and trying to understand why segfault would be bad security-wise. I can write code which will cause segfault. But how can it be used for previlege escalation <say, from normal-user to root> or how can it help one user to execute commands or read files as another user?
you don't understand what a segmentation fault is, and when it can occur. Also, just because a program segfaults doesn't mean it's a security risk [but it does mean there's something wrong with the program]. When you will fully understand it, I'm sure you'll know how one can "excute commands as another user". Good luck.
Ah, maybe you'd like some book titles:
Advanced Programming in the Unix Environment [ Richard Stevens ]
Advanced Linux Programming
Unix Network Programming
Also, you should try to learn at least some x86 assembly.
Once you've done that, if you haven't figured it out by yourself, you can try:
The Shellcoder's Handbook
The Art of Exploitation
.. but I doubt they'll be relevant if you fully comprehend the programming books.
I am a C newbie and trying to understand why segfault would be bad security-wise. I can write code which will cause segfault. But how can it be used for previlege escalation <say, from normal-user to root> or how can it help one user to execute commands or read files as another user?
TIA.
sounds like you want information on buffer overflows.. try a googling on buffer overflow related topics and you will find what you are looking for..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.