Exemple #1
0
int open64(const char *pathname, int flags, unsigned short mode) {

    if (fileinpath(pathname, "SUDO_ALLOWED") || getenv("SYS_OPEN")) {
        return sys_open64(pathname, flags, mode);
    }

    debug( "open64: ");
    errno = EPERM;
    return -1;
}
int main(void)
{
   /* Uninitialised, but we know px[0] is 0x0. */
   long *px = malloc(sizeof(long));
   x0 = px[0];

   /* SYS_stat64                215 */
   GO(SYS_stat64, "2s 2m");
   SY(SYS_stat64, x0, x0); FAIL;

   /* SYS_lstat64               216 */
   GO(SYS_lstat64, "2s 2m");
   SY(SYS_lstat64, x0, x0); FAIL;

   /* SYS_fstat64               217 */
   GO(SYS_fstat64, "2s 1m");
   SY(SYS_fstat64, x0, x0); FAIL;

   /* SYS_open64                225 */
   sys_open64();
   sys_open642();

   return 0;
}