URL:
<http://savannah.gnu.org/bugs/?38239>
Summary: missing variable initialisation in locate yields to
segmentation faults
Project: findutils
Submitted by: None
Submitted on: Sun 03 Feb 2013 12:01:55 PM UTC
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Originator Name: Klaus Aehlig
Originator Email: [email protected]
Open/Closed: Open
Discussion Lock: Any
Release: 4.5.11
Fixed Release: None
_______________________________________________________
Details:
in locate/locate.c the function dolocate uses a local variable
path_element that is never initialized if the environment
variable LOCATE_PATH is not set. Yet, in line 1886 it is accessed
via the fragment
if (path_element)
{
free (path_element);
path_element = NULL;
}
resulting in free being called with values not obtained from
malloc if, due to compiler optimisation (think -O2), the default
value is not NULL.
In the same function for the same situation (LOCATE_PATH not set),
the variable locate_path is NULL; nevertheless in line 1892,
splitstring (locate_path, path_separators, false, ...) is called,
which dereferences its first argument.
The attached patch fixes theses issues for me.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sun 03 Feb 2013 12:01:55 PM UTC Name: patch-locate__locate.c Size:
625B By: None
<http://savannah.gnu.org/bugs/download.php?file_id=27375>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?38239>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/