thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Application & OT Security · Advanced

Off-by-One Error

A boundary error where a loop or calculation uses one too many or too few iterations, often overwriting a single byte past a buffer.

Definition

Common causes are using <= instead of < or forgetting the null terminator. Even a single-byte overwrite can be exploitable. Prevented by careful bounds handling, safe string APIs, code review and fuzzing with sanitizers.

Example

A loop copies 256 characters into a 256-byte buffer and then appends a null terminator out of bounds.

Exam tip

Classic code review and fuzzing find; tracked as CWE-193.

Related terms