aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/unittest/string_test.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-14Revert gerrit 16429 to fix a Debian build-breakDave Barach1-22/+44
Change-Id: I9382bc981c25a29c293f7ddc6ed3d34130678696 Signed-off-by: Dave Barach <dave@barachs.net>
2018-12-14Fix compiling issue with GCC-8.x in string test functionsLijian.Zhang1-44/+22
Same pointer is passed to two or more restrict-qualified parameters of a function. vpp/src/plugins/unittest/string_test.c: In function ‘test_strcpy_s’: vpp/src/plugins/unittest/string_test.c:562:19: error: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Werror=restrict] err = strcpy_s (dst, s1size, dst); ^~~ ~~~ Change-Id: Ica06b457bbcbf2d552eec380976c37f9fd447b1c Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com> Reviewed-by: Sirshak Das <sirdas@arm.com>
2018-12-05Fix gcc-8 compile issues in string_test.cDave Barach1-1/+35
gcc-8 flunks a certain number of tests at compile time, so conditionally disable (negative) tests which won't even compile. Change-Id: Id7e85f38bc371623972efa6e2c8f9ee4717f5ff5 Signed-off-by: Dave Barach <dave@barachs.net>
2018-12-02vppinfra: c11 safe string functionsSteven1-25/+1559
Add memcmp_s, strcmp_s, strncmp_s, strcpy_s, strncpy_s, strcat_s, strncat_s, strtok_s, strnlen_s, and strstr_s C11 safe string API. For migrating extant unsafe API, add also the corresponding macro version of each safe API, clib_memcmp, clib_strcmp, etc. In general, the benefits of the safe string APIs are to provide null pointer checks, add additional argument to specify the string length of the passed string rather than relying on the null terminated character, and src/dest overlap checking for the the string copy operations. The macro version of the API takes the same number of arguments as the unsafe API to provide easy migration. However, it does not usually provide the full aformentioned benefits. In some cases, it is necessary to move to the safe API rather than using the macro in order to avoid some unpredictable problems such as accessing memory beyond what it is intended due to the lack of the passed string length. dbarach: add a "make test" vector, and a doxygen file header cookie. Change-Id: I5cd79b8928dcf76a79bf3f0b8cbc1a8f24942f4c Signed-off-by: Steven <sluong@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-23c11 safe string handling supportDave Barach1-0/+145
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>