You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2022/01/03 22:34:44 UTC

[GitHub] [logging-log4cxx] rm5248 commented on a change in pull request #95: Add short filename to location info

rm5248 commented on a change in pull request #95:
URL: https://github.com/apache/logging-log4cxx/pull/95#discussion_r777736412



##########
File path: src/main/cpp/locationinfo.cpp
##########
@@ -45,16 +45,35 @@ LocationInfo::LocationInfo( const char* const fileName1,
 	int lineNumber1 )
 	:  lineNumber( lineNumber1 ),
 	   fileName( fileName1 ),
+	   shortFileName(nullptr),
 	   methodName( methodName1 )
 {
 }
 
+LocationInfo::LocationInfo( const char* const fileName1,
+							size_t shortFilenameOffset,
+	const char* const methodName1,
+	int lineNumber1 )
+	:  lineNumber( lineNumber1 ),
+	   fileName( fileName1 ),
+	   methodName( methodName1 )
+{
+	if( shortFilenameOffset < 0 || shortFilenameOffset > 300 ){

Review comment:
       My (perhaps misguided) reasoning is that because this accesses a `const char*` directly, that could let you access arbitrary memory.  I'm not sure how likely that is though.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org