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 Destination is not aligned on a 16-bit boundary, then ASSERT(). If Source is not aligned on a 16-bit boundary, then ASSERT(). If an error would be returned, then the function will also
| 404 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap. |
| 405 | **/ |
| 406 | RETURN_STATUS |
| 407 | EFIAPI |
| 408 | StrCatS ( |
| 409 | IN OUT CHAR16 *Destination, |
| 410 | IN UINTN DestMax, |
| 411 | IN CONST CHAR16 *Source |
| 412 | ) |
| 413 | { |
| 414 | UINTN DestLen; |
| 415 | UINTN CopyLen; |
| 416 | // UINTN SourceLen; |
| 417 | |
| 418 | ASSERT (((UINTN) Destination & BIT0) == 0); |
| 419 | ASSERT (((UINTN) Source & BIT0) == 0); |
| 420 | |
| 421 | // |
| 422 | // Let CopyLen denote the value DestMax - StrnLenS(Destination, DestMax) upon entry to StrCatS. |
| 423 | // |
| 424 | DestLen = StrnLenS (Destination, DestMax); //Slice: DestLen <= DestMax |
| 425 | CopyLen = DestMax - DestLen; |
| 426 | |
| 427 | // |
| 428 | // 1. Neither Destination nor Source shall be a null pointer. |
| 429 | // |
| 430 | SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); |
| 431 | SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); |
| 432 | |
| 433 | // |
| 434 | // 2. DestMax shall not be greater than RSIZE_MAX. |
| 435 | // |
| 436 | // if (RSIZE_MAX != 0) { |
| 437 | // SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER); |
| 438 | // if (DestMax > RSIZE_MAX) { |
| 439 | // DestMax = RSIZE_MAX; |
| 440 | // } |
| 441 | // } |
| 442 | |
| 443 | // |
| 444 | // 3. DestMax shall not equal zero. |
| 445 | // |
| 446 | SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); |
| 447 | |
| 448 | // |
| 449 | // 4. CopyLen shall not equal zero. |
| 450 | // |
| 451 | SAFE_STRING_CONSTRAINT_CHECK ((CopyLen != 0), RETURN_BAD_BUFFER_SIZE); |
| 452 | |
| 453 | // |
| 454 | // 5. CopyLen shall be greater than StrnLenS(Source, CopyLen). |
| 455 | // |
| 456 | // SourceLen = StrnLenS (Source, CopyLen); //Slice: SourceLen <= CopyLen |
| 457 | // SAFE_STRING_CONSTRAINT_CHECK ((CopyLen > SourceLen), RETURN_BUFFER_TOO_SMALL); |
| 458 | |
| 459 | // |
| 460 | // 6. Copying shall not take place between objects that overlap. |
| 461 | // |
| 462 | // SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); |
| 463 |
no test coverage detected