cybersecurity · beginner · ~15 min · safe pentest lab

Is the directory entry deleted?

Detect the FAT deleted-entry marker.

Challenge

Detect a deleted FAT directory entry from its first byte — FAT marks deletion by overwriting only that byte with 0xE5.

Task

Implement int is_deleted(unsigned char first) that returns 1 if first == 0xE5, and 0 otherwise.

Input

  • first: the first byte of a FAT directory entry, supplied by the grader.

Output

Returns 1 for a deleted entry, 0 for a live one.

Example

is_deleted(0xE5)   ->   1
is_deleted('A')    ->   0

Edge cases

  • Only the value 0xE5 counts as deleted.

Input format

The first byte (unsigned char) of a FAT directory entry.

Output format

1 if first == 0xE5; otherwise 0.

Constraints

Compare against the sentinel 0xE5.

Starter code

int is_deleted(unsigned char first) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.