Can't Declare Variables in Capsicum

I've been trying to sandbox my program with Capsicum, but I am unable to declare variables after I call cap_enter().

Code:
int initBlackBox()
{
    /* Declare Variables */
    int rtrn;

    /* SandBox BlackBox with Capscium. */
    rtrn = cap_enter();
    if(rtrn < 0)
    {
     return -1;
    }
    
    /* Display Starting Banner */
    startingBanner();
    
    /* Display Copywright and wait for user to read */
    displayCopywright();
    
    /* Check If Log File Exist. */
    rtrn = checkLog();
    if(rtrn < 0)
    {
        return -1;
    }
    ...

}

The Program Segfaults in checkLog(), At the Variable Declarartions.
Code:
int checkLog()
{
    
    /* Declarations. */
    int fd, rtrn;
    char *path, *p1, *p2;
    cap_rights_t rights;

   ...
}

So how do I declare variables under Capsicum?
 
There is not enough data to conclude anything.

cap_enter has no effect on the ability to declare variables. Of course it may be there is a weird bug which causes havoc, but this is highly unlikely.

I can only suggest you post entire source + compile with -O0 -g3 + post backtrace from the debugger when the program crashes.
 
Back
Top