OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
855 stars 310 forks source link

lib/vector/vlib: Fix possible null pointer dereference #4638

Open ymdatta opened 3 weeks ago

ymdatta commented 3 weeks ago

In the function Vect_cat_list_to_array, as part of the execution, if list turns out to not contain any numbers, cats internal variable is not changed from NULL. Without checking if cats is NULL or not, qsort or first elemnt of it is accessed, which can lead to null pointer dereference.

To fix that issue, only access cats if it's not NULL.

This issue was found using cppcheck tool.