fix(strings): fix access out-of-bounds when converting zero-length strings to null-terminated strings
This commit is contained in:
		@@ -1124,10 +1124,7 @@ public:
 | 
				
			|||||||
	/** @return The non-modifiable standard C character string version of the string. */
 | 
						/** @return The non-modifiable standard C character string version of the string. */
 | 
				
			||||||
	NODISCARD FORCEINLINE auto operator*() &&
 | 
						NODISCARD FORCEINLINE auto operator*() &&
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (this->Back() != LITERAL(T, '\0'))
 | 
							if (!EndsWith(LITERAL(T, '\0'))) this->PushBack(LITERAL(T, '\0'));
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			this->PushBack(LITERAL(T, '\0'));
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return AsConst(*this).GetData();
 | 
							return AsConst(*this).GetData();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -493,7 +493,7 @@ public:
 | 
				
			|||||||
	/** @return The non-modifiable standard C character string version of the string view. */
 | 
						/** @return The non-modifiable standard C character string version of the string view. */
 | 
				
			||||||
	NODISCARD FORCEINLINE auto operator*() const
 | 
						NODISCARD FORCEINLINE auto operator*() const
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (this->Back() == LITERAL(FElementType, '\0') || Contains(LITERAL(FElementType, '\0')))
 | 
							if (EndsWith(LITERAL(FElementType, '\0')) || Contains(LITERAL(FElementType, '\0')))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return NAMESPACE_PRIVATE::TCStringFromTStringView<FElementType>(this->GetData(), false);
 | 
								return NAMESPACE_PRIVATE::TCStringFromTStringView<FElementType>(this->GetData(), false);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user