mirror of https://gerrit.osmocom.org/libusrp
usrp_prims_common: fix use-after-free in get_proto_filename()
Every time the get_proto_filename() is called, a new instance of std::string is allocated for the first argument. When the function returns, this instance gets deallocated. Therefore, the returned user_filename.c_str() points to free()d memory. Change-Id: Ib0007e9aebd9e77c28531c1ec70c61f1723a2d0d Fixes: CID#240724
This commit is contained in:
parent
559899621b
commit
ae3d54ceeb
|
@ -85,7 +85,7 @@ find_file (const char *filename, int hw_rev)
|
|||
}
|
||||
|
||||
static const char *
|
||||
get_proto_filename(const std::string user_filename, const char *env_var, const char *def)
|
||||
get_proto_filename(const std::string &user_filename, const char *env_var, const char *def)
|
||||
{
|
||||
if (user_filename.length() != 0)
|
||||
return user_filename.c_str();
|
||||
|
|
Loading…
Reference in New Issue