• C string handling (redirect from Strncpy)
    Truncating strings with variable-width characters using functions like strncpy can produce invalid sequences at the end of the string. This can be unsafe...
    48 KB (3,568 words) - 02:41, 20 February 2025
  • Thumbnail for String (computer science)
    Machine "A rant about strcpy, strncpy and strlcpy." Archived 2016-02-29 at the Wayback Machine Keith Thompson. "No, strncpy() is not a "safer" strcpy()"...
    41 KB (5,027 words) - 16:16, 11 May 2025
  • buffer, a buffer overflow will occur. To fix this unsafe program, use strncpy to prevent a possible buffer overflow. int secure_function(char * user_input)...
    8 KB (988 words) - 17:30, 1 September 2024
  • Berkeley DB strlcat() and strlcpy() – secure alternatives for strncat() and strncpy() err.h – contains some functions to print formatted error messages vis...
    37 KB (3,694 words) - 11:18, 26 January 2025
  • exceeding the length of the destination. strncpy(str, input, sizeof(str)); // If strlen(input) >= sizeof(str) then strncpy won't null terminate. // We counter...
    14 KB (1,744 words) - 12:13, 10 May 2025
  • respect to whether one needs to subtract 1 byte – functions like fgets() and strncpy will never write past the length given them (fgets() subtracts 1 itself...
    10 KB (1,340 words) - 21:48, 8 January 2025
  • number of hand-optimised instructions to implement strncpy is in excess of 240. By contrast, the same strncpy routine in hand-optimised RVV assembler is a mere...
    61 KB (8,675 words) - 10:31, 28 April 2025
  • Thumbnail for Buffer overflow
    sizeof(A)); When available, the strlcpy library function is preferred over strncpy which does not null-terminate the destination buffer if the source string's...
    46 KB (5,132 words) - 08:55, 25 May 2025
  • LEFT$(string,n) BASIC, VB left(string,n) VB, FreeBASIC, Ingres, Pick Basic strncpy(string2, string, n) C standard library string.substr(0,n) C++ (STL), Raku...
    125 KB (4,077 words) - 12:50, 22 February 2025
  • functions in the C programming language. There are two common alternatives, strncpy and strncat, but they can also be difficult to understand and easy to misuse...
    30 KB (3,213 words) - 16:56, 19 May 2025