Hi

Maybe you just enlarge the stack segment size ?
'limit' will give you the limits of few parameters, and you can change each of them by 
'limit <parameter> <newvalue> '
Another idea : declare 'a' to be static or allocate it on the heap.
I think the segmentation fault is a very elegant way, because this is what actually 
happened.

Haim



________________________________________@/'
Haim Cohen
Software Engineer
CAD group
Analog Devices
Israel
(972) - 9 - 9715 406

> -----Original Message-----
> From: Orna Agmon [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 19, 2003 12:51
> To: Haifa Linux club
> Subject: [Haifux] stack size
> 
> 
> Hello eveyone,
> 
> I was wondering if there was anything that detected C stack 
> overflow in a 
> nice way (i.e., not by having to cut down my program until I 
> stop getting 
> a segmentation fault on the first line of main).
> 
> In details:
> 
> I have a program that looks somewhat like that:
> 
> typedef struct{
>  /*a huge struct definition*/
> } a_t;
> 
> int main(int argc, char *argv){
>   a_t a;
>   return 0;
> }
> 
> and I want to get something politer than a segmentation fault.
>  I found some info on preventing attacks on the stack, so it 
> seems to me 
> that it should be possible to do this in a non- hostile manner.
> 
> BTW, it is not a problem of lack of memory- the same struct can be 
> allocated on the heap.
>   
> 
> Thanks,
>       Orna.
> -- 
> Orna.   |  http://vipe.technion.ac.il/~ladypine/
> 
> I am not a number, I am a free person!
> 
> 
> 
> --------------------------------------------------------------
> ------------
> Haifa Linux Club Mailing List (http://www.haifux.org)
> To unsub send an empty message to [EMAIL PROTECTED]
> 
> 
> 

--------------------------------------------------------------------------
Haifa Linux Club Mailing List (http://www.haifux.org)
To unsub send an empty message to [EMAIL PROTECTED]


Reply via email to