News for hackers. Stuff that matters.
Re:The trouble with struct sockaddr's fake flexible array by asveikau on Friday November 29, 2024 @10:25AM (#42274472)
That's essentially what it is.

You can determine the size by looking at sa_family.

Some platforms also have an sa_len field.

It's still unsafe if you allocate for the "base" type of struct sockaddr then try to use it for something larger, but that generally is not done. People usually allocate for the exact type they want, and only pointers to the structure are passed around, often opaquely.

There are no comments on this comment yet.