All books

Professional

Apps About Coach Log in Start reading

Computer Science · Glossary

What is Buffer overflow?

Definition 6.2 University Computer Science — Year 1 · Chapter 6 — Strings, Structures and Files

A buffer overflow is a write past the end (or before the start) of an array, into the memory that follows it. It is undefined behaviour; in practice, it changes whatever the program keeps there.

The thirteen bytes written by strcpy. The last two letters fall into the two unused bytes that keep age at an offset multiple of 4; the zero byte that ends the string lands on the low byte of age, stored first, and 19 becomes 0.
The thirteen bytes written by strcpy. The last two letters fall into the two unused bytes that keep age at an offset multiple of 4; the zero byte that ends the string lands on the low byte of age, stored first, and 19 becomes 0.
Read in context →