On Mon, 4 Nov 2024 14:25:02 -0800 Kees Cook wrote:
I think for getname() (and similar interfaces) we *do* want to use
sockaddr_storage, but there is kind of an argument to instead use
a struct with a flexible array, e.g.:
struct sockaddr_unspec {
sa_family_t sa_family;
char sa_data[];
};
If this was done, then all these APIs would switch their casts from
"(struct sockaddr *)" to "(struct sockaddr_unspec *)", even though in
most cases the object is actully a struct sockaddr_storage.
struct sockaddr_unspec was my knee-jerk reaction but looking at the code
- indeed passing struct sockaddr_storage seems cleaner.
What do folks think?
Looks nice, and feels like the right direction :)
FWIW if the conversion work is too tedious I think I can find some
people that could help.