diff options
| author | F. Aragon <paco@voltanet.io> | 2018-07-03 20:07:25 +0200 | 
|---|---|---|
| committer | F. Aragon <paco@voltanet.io> | 2018-07-04 00:01:22 +0200 | 
| commit | 4149ef7c0f0876a2b9fdfe34afc1ecd9036b2382 (patch) | |
| tree | 22341ea9b9bcd5bb71483cf5559f7906233690d5 /ldpd/ldpd.h | |
| parent | 7f04893904881c2822a3736d004358a0dad9f959 (diff) | |
ldpd: buffer underflow, thread safety (PVS-Studio)
This commit fixes two issues:
- memcpy() using containers of different sizes when using addr2sa(), mixing
  'struct sockaddr_storage' and 'union sockunion'.
- addr2sa() function not being thread safe (using a local static variable as
  container.
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'ldpd/ldpd.h')
| -rw-r--r-- | ldpd/ldpd.h | 3 | 
1 files changed, 2 insertions, 1 deletions
diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h index ed0a5407b2..9113505581 100644 --- a/ldpd/ldpd.h +++ b/ldpd/ldpd.h @@ -691,7 +691,8 @@ void		 embedscope(struct sockaddr_in6 *);  void		 recoverscope(struct sockaddr_in6 *);  void		 addscope(struct sockaddr_in6 *, uint32_t);  void		 clearscope(struct in6_addr *); -struct sockaddr	*addr2sa(int af, union ldpd_addr *, uint16_t); +void		 addr2sa(int af, const union ldpd_addr *, uint16_t, +		    union sockunion *su);  void		 sa2addr(struct sockaddr *, int *, union ldpd_addr *,  		    in_port_t *);  socklen_t	 sockaddr_len(struct sockaddr *);  | 
