MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / AsciiStrCatS

Function AsciiStrCatS

MdePkg/Library/BaseLib/SafeString.c:1985–2049  ·  view source on GitHub ↗

Appends a copy of the string pointed to by Source (including the terminating null char) to the end of the string pointed to by Destination. This function is similar as strcat_s defined in C11. If an error would be returned, then the function will also ASSERT(). If an error is returned, then the Destination is unmodified. @param Destination A pointer to a Null-t

Source from the content-addressed store, hash-verified

1983 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
1984**/
1985RETURN_STATUS
1986EFIAPI
1987AsciiStrCatS (
1988 IN OUT CHAR8 *Destination,
1989 IN UINTN DestMax,
1990 IN CONST CHAR8 *Source
1991 )
1992{
1993 UINTN DestLen;
1994 UINTN CopyLen;
1995// UINTN SourceLen;
1996
1997 //
1998 // Let CopyLen denote the value DestMax - AsciiStrnLenS(Destination, DestMax) upon entry to AsciiStrCatS.
1999 //
2000 DestLen = AsciiStrnLenS (Destination, DestMax);
2001 CopyLen = DestMax - DestLen;
2002
2003 //
2004 // 1. Neither Destination nor Source shall be a null pointer.
2005 //
2006 SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER);
2007 SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER);
2008
2009 //
2010 // 2. DestMax shall not be greater than ASCII_RSIZE_MAX.
2011 //
2012// if (ASCII_RSIZE_MAX != 0) {
2013// SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
2014// }
2015
2016 //
2017 // 3. DestMax shall not equal zero.
2018 //
2019 SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER);
2020
2021 //
2022 // 4. CopyLen shall not equal zero.
2023 //
2024 SAFE_STRING_CONSTRAINT_CHECK ((CopyLen != 0), RETURN_BAD_BUFFER_SIZE);
2025
2026 //
2027 // 5. CopyLen shall be greater than AsciiStrnLenS(Source, CopyLen).
2028 //
2029// SourceLen = AsciiStrnLenS (Source, CopyLen);
2030// SAFE_STRING_CONSTRAINT_CHECK ((CopyLen > SourceLen), RETURN_BUFFER_TOO_SMALL);
2031
2032 //
2033 // 6. Copying shall not take place between objects that overlap.
2034 //
2035// SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
2036
2037 //
2038 // The AsciiStrCatS function appends a copy of the string pointed to by Source (including the
2039 // terminating null character) to the end of the string pointed to by Destination. The initial character
2040 // from Source overwrites the null character at the end of Destination.
2041 //
2042 Destination = Destination + DestLen;

Callers 8

GetPlistHexValueFunction · 0.85
strcatFunction · 0.85
nsvg__parseUseFunction · 0.85
GetPcdNameFunction · 0.85
GetPcdNameFunction · 0.85
AppleDebugLogPrintFunction · 0.85
OcLogAddEntryFunction · 0.85

Calls 1

AsciiStrnLenSFunction · 0.85

Tested by

no test coverage detected