test_strncat_n_gt_buf.c (314B)
1 #include "common.h" 2 3 #include <string.h> 4 5 int main(int argc, char** argv) { 6 char buffer[8] = {0}; 7 strncat(buffer, "12345", 5); 8 puts(buffer); 9 10 /* n > buffer size and overflow: n=10, buffer has 5 chars. */ 11 CHK_FAIL_START 12 strncat(buffer, "1234567890", 10); 13 CHK_FAIL_END 14 15 puts(buffer); 16 return ret; 17 }