Avoid out-of-bounds access when checking file extensions.
Include the '.' in the file extension check. PiperOrigin-RevId: 474866478 Change-Id: I809ae975e4c8b00f17278735975a7d07e0748643
This commit is contained in:
committed by
Copybara-Service
parent
68718e76b1
commit
f556d4d94f
@@ -16,6 +16,7 @@
|
||||
#define MUJOCO_SRC_USER_USER_UTIL_H_
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
extern const double mjNAN; // used to mark undefined fields
|
||||
@@ -129,6 +130,9 @@ std::string mjuu_strippath(std::string filename);
|
||||
// strip extension from filename
|
||||
std::string mjuu_stripext(std::string filename);
|
||||
|
||||
// get the extension of a filename
|
||||
std::string mjuu_getext(std::string_view filename);
|
||||
|
||||
// check if path is absolute
|
||||
bool mjuu_isabspath(std::string path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user