cybersecurity · intermediate · ~15 min · safe pentest lab
Extract the type nibble.
Extract the type from an ELF symbol's st_info byte — the low nibble that says whether a symbol names a function, an object, etc.
Implement int symbol_type(unsigned char info) that returns the low nibble, info & 0xF.
info: one st_info byte from an ELF symbol-table entry. The grader passes fixed values.Returns int: the type, info & 0xF (0=NOTYPE, 1=OBJECT, 2=FUNC).
symbol_type(0x12) -> 2 (FUNC)
symbol_type(0x11) -> 1 (OBJECT)
An st_info byte info.
An int: the type nibble info & 0xF.
Type is the low nibble (info & 0xF).
int symbol_type(unsigned char info) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.