cybersecurity · beginner · ~15 min · safe pentest lab

BLE AD structure length

Read the AD length byte.

Challenge

A BLE advertising data structure is Length-Type-Value; byte 0 is the length (of type+value). Implement int ad_length(const unsigned char *ad) returning ad[0].

Starter code

int ad_length(const unsigned char *ad) {
    /* TODO */
    return 0;
}

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