In a struct sockaddr, sa->sa_len can be zero if uninitialized.
Make sure that this doesn't cause a problem when parsing.
This commit is contained in:
parent
1bf6f71909
commit
1baeddb81b
@ -149,7 +149,7 @@ ng_parse_generic_sockdata_getLength(const struct ng_parse_type *type,
|
||||
const struct sockaddr *sa;
|
||||
|
||||
sa = (const struct sockaddr *)(buf - SADATA_OFFSET);
|
||||
return sa->sa_len - SADATA_OFFSET;
|
||||
return (sa->sa_len < SADATA_OFFSET) ? 0 : sa->sa_len - SADATA_OFFSET;
|
||||
}
|
||||
|
||||
/* Type for the variable length data portion of a generic struct sockaddr */
|
||||
|
Loading…
x
Reference in New Issue
Block a user