Skip to content

Commit e0698be

Browse files
object_path: fix potential buffer overrun
The `filename` function attempted to look at the first character of a substring, which could have been empty. This was noticed by UBSAN in GCC 13.2. Signed-off-by: Patrick Williams <[email protected]> Change-Id: I7397861b6b19ef86d1c5c01dc1007a8804d08ab6
1 parent 1a39b64 commit e0698be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/message/native_types.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ std::string string_path_wrapper::filename() const
6464

6565
// If we don't see that this was encoded by sdbusplus, return the naive
6666
// version of the filename path.
67-
if (filename[0] != '_')
67+
if (filename.empty() || filename[0] != '_')
6868
{
6969
return std::string(filename);
7070
}

0 commit comments

Comments
 (0)