Messages in this thread | | | Date | Mon, 9 Oct 2017 18:33:59 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH 2/5] trace-cmd: Fix NULL pointer being passed to memcpy |
| |
On Mon, 9 Oct 2017 16:27:10 -0600 Michael Sartain <mikesart@fastmail.com> wrote:
> > > - memcpy(option->data, data, size); > > > + > > > + /* Some IDs (like TRACECMD_OPTION_TRACECLOCK) pass NULL data */ > > > + if (data) > > > + memcpy(option->data, data, size); > > > > Is this a problem, as when this happens, size should be zero. Does it > > crash with data=NULL and size=0, or have you seen size not be zero? > > I got an ASAN warning, but you are correct - the size was 0 and it did > not crash.
OK, but it's almost like dividing zero from zero. Can you send another patch, but this time check if (size) instead of if (data).
-- Steve
| |