From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:12:45
This series collects patches from v1 which resolve situations where
garbage might be read, either due to missing initialization of
variables or accessing data which went out of scope.
No changes to the actual patches, just splitting into smaller series.
Phil Sutter (7):
ipaddress: Make buffer for filter.flushb static
ipaddress: Avoid accessing uninitialized variable lcl
iplink_can: Prevent overstepping array bounds
ipmaddr: Avoid accessing uninitialized data
ss: Use C99 initializer in netlink_show_one()
netem/maketable: Check return value of fstat()
tc/q_multiq: Don't pass garbage in TCA_OPTIONS
ip/ipaddress.c | 4 ++--
ip/iplink_can.c | 4 ++--
ip/ipmaddr.c | 2 +-
misc/ss.c | 13 +++++++------
netem/maketable.c | 4 ++--
tc/q_multiq.c | 2 +-
6 files changed, 15 insertions(+), 14 deletions(-)
--
2.13.1
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:10:08
This has the additional benefit of initializing st.ino to zero which is
used later in is_sctp_assoc() function.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
misc/ss.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:11:30
multiq_parse_opt() doesn't change 'opt' at all. So at least make sure
it doesn't fill TCA_OPTIONS attribute with garbage from stack.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
tc/q_multiq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:11:49
The buffer is accessed outside of the function defining it, so make it
static.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
ip/ipaddress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:12:20
If no address was given, ipaddr_modify() accesses uninitialized data
when assigning to req.ifa.ifa_prefixlen.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
ip/ipaddress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -1888,7 +1888,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv)char*lcl_arg=NULL;char*valid_lftp=NULL;char*preferred_lftp=NULL;-inet_prefixlcl;+inet_prefixlcl={};inet_prefixpeer;intlocal_len=0;intpeer_len=0;
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:13:16
Looks like this can only happen if /proc/net/igmp is malformed, but
better be sure.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
ip/ipmaddr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:13:42
can_state_names array contains at most CAN_STATE_MAX fields, so allowing
an index to it to be equal to that number is wrong. While here, also
make sure the array is indeed that big so nothing bad happens if
CAN_STATE_MAX ever increases.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
ip/iplink_can.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-18 11:57:04
On Thu, Aug 17, 2017 at 07:09:25PM +0200, Phil Sutter wrote:
The buffer is accessed outside of the function defining it, so make it
static.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Self-NACK: Access to flushb should be sane since all accessors are
called from ipaddr_flush(). Looking at the covscan output again, it
merely complained about filter.flusb still pointing to the local buffer
when ipaddr_flush() returns.
Cheers, Phil
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2017-08-18 15:55:27
On Fri, 18 Aug 2017 13:57:03 +0200
Phil Sutter [off-list ref] wrote:
On Thu, Aug 17, 2017 at 07:09:25PM +0200, Phil Sutter wrote:
quoted
The buffer is accessed outside of the function defining it, so make it
static.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Self-NACK: Access to flushb should be sane since all accessors are
called from ipaddr_flush(). Looking at the covscan output again, it
merely complained about filter.flusb still pointing to the local buffer
when ipaddr_flush() returns.
Cheers, Phil