lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190304165653.17699f9f@gandalf.local.home>
Date:   Mon, 4 Mar 2019 16:56:53 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Tom Zanussi <zanussi@...nel.org>
Cc:     linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org,
        Tom Zanussi <tom.zanussi@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH 2/2] tracing: Use strncpy instead of memcpy for string
 keys in hist triggers

On Mon, 4 Mar 2019 16:50:00 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:

> > +++ b/kernel/trace/trace_events_hist.c
> > @@ -4695,9 +4695,10 @@ static inline void add_to_key(char *compound_key, void *key,
> >  		/* ensure NULL-termination */
> >  		if (size > key_field->size - 1)
> >  			size = key_field->size - 1;
> > -	}
> >  
> > -	memcpy(compound_key + key_field->offset, key, size);
> > +		strncpy(compound_key + key_field->offset, (char *)key, size);
> > +	} else
> > +		memcpy(compound_key + key_field->offset, key, size);
> >  }
> >    
> 
> Shouldn't we use strncpy() in save_comm() too. Feels safer.

Note, if that is changed, it can be another patch. This one is fine as
is. I just was looking at other use cases of memcpy() in that file.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ