networking · intermediate · ~15 min

TLS record length

Read the big-endian record length.

Challenge

The TLS record length is the big-endian 16-bit value at offset 3. Implement int tls_record_length(const unsigned char *rec) returning it.

Starter code

int tls_record_length(const unsigned char *rec) {
    /* TODO */
    return 0;
}

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