test_vsnprintf_static.c (589B)
1 #include "common.h" 2 3 #include <stdarg.h> 4 #include <unistd.h> 5 6 char buffer[12] = {0}; 7 8 int msg_valid(int n, const char * format, ... ) { 9 va_list args; 10 va_start (args, format); 11 vsnprintf(buffer, n, format, args); 12 va_end (args); 13 return 0; 14 } 15 16 int msg(int n, const char * format, ... ) { 17 va_list args; 18 va_start (args, format); 19 CHK_FAIL_START 20 vsnprintf(buffer, n, format, args); 21 CHK_FAIL_END 22 va_end (args); 23 return ret; 24 } 25 26 int main(int argc, char** argv) { 27 msg_valid(sizeof(buffer), "%s", "1234567890ABCDEF"); 28 return msg(sizeof(buffer)+1, "%s", "1234567890ABCDEF"); 29 }