File tree 9 files changed +69
-0
lines changed
9 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 46
46
* DESCRIPTION
47
47
* The stpcpy_s function copies the string pointed to by src
48
48
* (including the terminating null character) into the array
49
+ #ifdef SAFECLIB_STR_NULL_SLACK
49
50
* pointed to by dest. All elements following the terminating
50
51
* null character (if any) written by stpcpy_s in the array
51
52
* of dmax characters pointed to by dest are nulled when
52
53
* strcpy_s returns. The function returns a pointer to the
54
+ #else
55
+ * pointed to by dest. The function returns a pointer to the
56
+ #endif // SAFECLIB_STR_NULL_SLACK
53
57
* end of the string in dest - that is to the null terminator
54
58
* of dest - upon return. If an error occurs, NULL is returned
55
59
* and err is set to the error encountered.
88
92
* Copying shall not take place between objects that overlap.
89
93
* If there is a runtime-constraint violation, then if dest
90
94
* is not a null pointer and destmax is greater than zero and
95
+ #ifdef SAFECLIB_STR_NULL_SLACK
91
96
* not greater than RSIZE_MAX_STR, then stpcpy_s nulls dest.
97
+ #else
98
+ * not greater than RSIZE_MAX_STR, then stpcpy_s stores a 0
99
+ * terminator in dest.
100
+ #endif // SAFECLIB_STR_NULL_SLACK
92
101
*
93
102
* RETURN VALUE
94
103
* a char pointer to the terminating null at the end of dest
Original file line number Diff line number Diff line change 47
47
* The stpncpy_s function copies at most smax characters from the string
48
48
* pointed to by src, including the terminating null byte ('\0'), to the
49
49
* array pointed to by dest. Exactly smax characters are written at dest.
50
+ #ifdef SAFECLIB_STR_NULL_SLACK
50
51
* If the length strlen_s(src) is smaller than smax, the remaining smax
51
52
* characters in the array pointed to by dest are filled with null bytes.
53
+ #endif // SAFECLIB_STR_NULL_SLACK
52
54
* If the length strlen_s(src) is greater than or equal to smax, the string
53
55
* pointed to by dest will contain smax characters from src plus a null
54
56
* characters (dest will be null-terminated).
97
99
* If src and dest overlap, copying shall be stopped; destruction of src may have occurred.
98
100
* If there is a runtime-constraint violation, then:
99
101
* if dest is not a null pointer and dmax is greater than zero and
102
+ #ifdef SAFECLIB_STR_NULL_SLACK
100
103
* not greater than RSIZE_MAX_STR, then stpncpy_s shall fill dest with nulls,
101
104
* if library was compiled with SAFECLIB_STR_NULL_SLACK.
105
+ #else
106
+ * not greater than RSIZE_MAX_STR, then stpncpy_s shall write a terminator
107
+ * to the dest buffer.
108
+ #endif // SAFECLIB_STR_NULL_SLACK
102
109
*
103
110
* RETURN VALUE
104
111
* a char pointer to the terminating null at the end of dest
Original file line number Diff line number Diff line change 62
62
* INPUT PARAMETERS
63
63
* dest pointer to string that will be extended by src
64
64
* if dmax allows. The string is null terminated.
65
+ #ifdef SAFECLIB_STR_NULL_SLACK
65
66
* If the resulting concatenated string is less
66
67
* than dmax, the remaining slack space is nulled.
68
+ #endif // SAFECLIB_STR_NULL_SLACK
67
69
*
68
70
* dmax restricted maximum length of the resulting dest,
69
71
* including the null
82
84
* Copying shall not takeplace between objects that overlap
83
85
* If there is a runtime-constraint violation, then if dest is
84
86
* not a null pointer and dmax is greater than zero and not
87
+ #ifdef SAFECLIB_STR_NULL_SLACK
85
88
* greater than RSIZE_MAX_STR, then strcat_s nulls dest.
89
+ #else
90
+ * greater than RSIZE_MAX_STR, then strcat_s writes a terminator
91
+ * to dest.
92
+ #endif // SAFECLIB_STR_NULL_SLACK
86
93
*
87
94
* RETURN VALUE
88
95
* EOK successful operation, all the characters from src
Original file line number Diff line number Diff line change 46
46
* DESCRIPTION
47
47
* The strcpy_s function copies the string pointed to by src
48
48
* (including the terminating null character) into the array
49
+ #ifdef SAFECLIB_STR_NULL_SLACK
49
50
* pointed to by dest. All elements following the terminating
50
51
* null character (if any) written by strcpy_s in the array
51
52
* of dmax characters pointed to by dest are nulled when
52
53
* strcpy_s returns.
54
+ #else
55
+ * pointed to by dest.
56
+ #endif // SAFECLIB_STR_NULL_SLACK
53
57
*
54
58
* SPECIFIED IN
55
59
* ISO/IEC TR 24731, Programming languages, environments
75
79
* Copying shall not take place between objects that overlap.
76
80
* If there is a runtime-constraint violation, then if dest
77
81
* is not a null pointer and destmax is greater than zero and
82
+ #ifdef SAFECLIB_STR_NULL_SLACK
78
83
* not greater than RSIZE_MAX_STR, then strcpy_s nulls dest.
84
+ #else
85
+ * not greater than RSIZE_MAX_STR, then strcpy_s writes a
86
+ * terminator to dest.
87
+ #endif // SAFECLIB_STR_NULL_SLACK
79
88
*
80
89
* RETURN VALUE
81
90
* EOK successful operation, the characters in src were
Original file line number Diff line number Diff line change 48
48
* (characters that follow a null character are not copied) from the
49
49
* array pointed to by src to the array pointed to by dest. If no null
50
50
* character was copied from src, then dest[n] is set to a null character.
51
+ #ifdef SAFECLIB_STR_NULL_SLACK
51
52
*
52
53
* All elements following the terminating null character (if any)
53
54
* written by strncpy_s in the array of dmax characters pointed to
54
55
* by dest take on the null value when strncpy_s returns.
56
+ #endif // SAFECLIB_STR_NULL_SLACK
55
57
*
56
58
* Specicified in:
57
59
* ISO/IEC TR 24731-1, Programming languages, environments
82
84
* Copying shall not take place between objects that overlap.
83
85
* If there is a runtime-constraint violation, then if dest
84
86
* is not a null pointer and dmax greater than RSIZE_MAX_STR,
87
+ #ifdef SAFECLIB_STR_NULL_SLACK
85
88
* then strncpy_s nulls dest.
89
+ #else
90
+ * the strncpy_s writes a terminator to dest.
91
+ #endif // SAFECLIB_STR_NULL_SLACK
86
92
*
87
93
* RETURN VALUE
88
94
* EOK successful operation, the characters in src were copied
Original file line number Diff line number Diff line change 47
47
* The wcpcpy_s function copies the wide character string pointed
48
48
* to by src (including the terminating null character) into the
49
49
* array pointed to by dest, and returns a pointer to the end of
50
+ #ifdef SAFECLIB_STR_NULL_SLACK
50
51
* the wide character string. All elements following the terminating
51
52
* null character (if any) written by wcpcpy_s in the array of
52
53
* dmax characters pointed to by dest are nulled when
53
54
* wcpcpy_s returns.
55
+ #else
56
+ * the wide character string.
57
+ #endif // SAFECLIB_STR_NULL_SLACK
54
58
*
55
59
* SPECIFIED IN
56
60
* ISO/IEC TR 24731, Programming languages, environments
86
90
* Copying shall not take place between objects that overlap.
87
91
* If there is a runtime-constraint violation, then if dest
88
92
* is not a null pointer and destmax is greater than zero and
93
+ #ifdef SAFECLIB_STR_NULL_SLACK
89
94
* not greater than RSIZE_MAX_STR, then strcpy_s nulls dest.
95
+ #else
96
+ * not greater than RSIZE_MAX_STR, then strcpy_s stores a
97
+ * terminator at dest.
98
+ #endif // SAFECLIB_STR_NULL_SLACK
90
99
*
91
100
* RETURN VALUE
92
101
* a wchar_t pointer to the terminating null at the end of dest
Original file line number Diff line number Diff line change 48
48
* to by src (including the terminating null character) to the
49
49
* end of the string pointed to by dest. The initial wide character
50
50
* from src overwrites the null character at the end of dest.
51
+ #ifdef SAFECLIB_STR_NULL_SLACK
51
52
*
52
53
* All elements following the terminating null character (if
53
54
* any) written by strcat_s in the array of dmax characters
54
55
* pointed to by dest take unspecified values when strcat_s
55
56
* returns.
57
+ #endif // SAFECLIB_STR_NULL_SLACK
56
58
*
57
59
* SPECIFIED IN
58
60
* ISO/IEC TR 24731, Programming languages, environments
82
84
* Copying shall not takeplace between objects that overlap
83
85
* If there is a runtime-constraint violation, then if dest is
84
86
* not a null pointer and dmax is greater than zero and not
87
+ #ifdef SAFECLIB_STR_NULL_SLACK
85
88
* greater than RSIZE_MAX_STR, then strcat_s nulls dest.
89
+ #else
90
+ * greater than RSIZE_MAX_STR, then strcat_s stores a
91
+ * terminator at dest.
92
+ #endif // SAFECLIB_STR_NULL_SLACK
86
93
*
87
94
* RETURN VALUE
88
95
* EOK successful operation, all the characters from src
Original file line number Diff line number Diff line change 46
46
* DESCRIPTION
47
47
* The wcscpy_s function copies the wide character string pointed
48
48
* to by src (including the terminating null character) into the
49
+ #ifdef SAFECLIB_STR_NULL_SLACK
49
50
* array pointed to by dest. All elements following the terminating
50
51
* null character (if any) written by strcpy_s in the array of
51
52
* dmax characters pointed to by dest are nulled when
52
53
* wcscpy_s returns.
54
+ #else
55
+ * array pointed to by dest.
56
+ #endif // SAFECLIB_STR_NULL_SLACK
53
57
*
54
58
* SPECIFIED IN
55
59
* ISO/IEC TR 24731, Programming languages, environments
75
79
* Copying shall not take place between objects that overlap.
76
80
* If there is a runtime-constraint violation, then if dest
77
81
* is not a null pointer and destmax is greater than zero and
82
+ #ifdef SAFECLIB_STR_NULL_SLACK
78
83
* not greater than RSIZE_MAX_STR, then strcpy_s nulls dest.
84
+ #else
85
+ * not greater than RSIZE_MAX_STR, then strcpy_s stores a
86
+ * terminator at dest.
87
+ #endif // SAFECLIB_STR_NULL_SLACK
79
88
*
80
89
* RETURN VALUE
81
90
* EOK successful operation, the characters in src were
Original file line number Diff line number Diff line change 48
48
* (characters that follow a null character are not copied) from the
49
49
* array pointed to by src to the array pointed to by dest. If no null
50
50
* character was copied from src, then dest[slen] is set to a null character.
51
+ #ifdef SAFECLIB_STR_NULL_SLACK
51
52
*
52
53
* All elements following the terminating null character (if any)
53
54
* written by wcsncpy_s in the array of dmax characters pointed to
60
61
* array is used multiple times to string manipulation routines in this
61
62
* library. If this extra security is not required, ensure that the
62
63
* library is compiled without #DEFINE SAFECLIB_STR_NULL_SLACK.
64
+ #endif // SAFECLIB_STR_NULL_SLACK
63
65
*
64
66
* Specicified in:
65
67
* ISO/IEC TR 24731-1, Programming languages, environments
90
92
* Copying shall not take place between objects that overlap.
91
93
* If there is a runtime-constraint violation, then if dest
92
94
* is not a null pointer and dmax greater than RSIZE_MAX_STR,
95
+ #ifdef SAFECLIB_STR_NULL_SLACK
93
96
* then strncpy_s nulls dest.
97
+ #else
98
+ * then strncpy_s stores a terminator at dest.
99
+ #endif // SAFECLIB_STR_NULL_SLACK
94
100
*
95
101
* RETURN VALUE
96
102
* EOK successful operation, the characters in src were copied
You can’t perform that action at this time.
0 commit comments