4 ms·
The "buffer overflow within a struct" is used a lot when you have built a "header" struct that you are just pinning to the start of the some record and the bott
by jandrese 3y ago
The "buffer overflow within a struct" is used a lot when you have built a "header" struct that you are just pinning to the start of the some record and the bottom of the struct has a line like:
char data[0];
The purpose is to give you a handle on the remainder of the data even though you don't know the size beforehand.
Technically this is not valid under strict C, but it's also incredibly common.
- heywhatupboys 3y ago> Technically this is not valid under strict C, but it's also incredibly common. char data[] is valid C in recent versions if it is the last entry of a struct.
- layer8 3y agoTo elaborate, this is called "flexible array member" and was introduced with C99.