diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-10-25 00:11:46 +0300 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-10-25 00:15:39 +0300 |
commit | ae3d54ceebee91022932338eb821627e269c9649 (patch) | |
tree | c9accf9eab57bf58eded2f58b4284256f905639d | |
parent | 559899621befb11ed54b5876d79b16962eb348fc (diff) |
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
-rw-r--r-- | host/lib/usrp_prims_common.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/host/lib/usrp_prims_common.cc b/host/lib/usrp_prims_common.cc index 20a5565..ca9b447 100644 --- a/host/lib/usrp_prims_common.cc +++ b/host/lib/usrp_prims_common.cc @@ -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(); |