null pointer passed as argument 2 to memcpy(), which is declared to never be null

Allen Winter winter at kde.org
Sat Jan 20 14:37:40 PST 2018


Thanks Milan,
Committed in bc7dae39069728c09ee3ab06144024dd38d6cefa
will be part of the 3.0.2 release

On Wednesday, January 17, 2018 12:55:49 PM EST Milan Crha wrote:
> 	Hi,
> while have compiled libical and others with some code sanitizing
> options I noticed a runtime error on a console:
> 
> > libical/src/libical/icalarray.c:181:9: runtime error: null pointer
> > passed as argument 2, which is declared to never be null
> 
> That line calls memcpy() unconditionally. The thing is that for the
> first time, when the array is empty, the currently allocated chunks are
> NULL, hence the runtime warning.
> 
> Attached is a trivial patch which fixes it.
> 
> You can use realloc() instead, which accepts NULL, but I didn't went
> that far.
> 	Bye,
> 	Milan


-- 
Allen Winter | allen.winter at kdab.com | Senior Software Engineer
KDAB (USA) LLC, a KDAB Group company
Tel. USA +1-866-777-KDAB(5322) ext3
KDAB - The Qt, C++ and OpenGL Experts






More information about the libical-devel mailing list