CVE-2023-4154 dsdb/tests: Speed up DirSync test by only checking positive matches...
[Samba.git] / third_party / heimdal / cf / broken-snprintf.m4
blob02611166a522049edd993dab5ee49d328a492deb
1 dnl $Id$
2 dnl
3 AC_DEFUN([AC_BROKEN_SNPRINTF], [
4 AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
5 ac_cv_func_snprintf_working=yes
6 AC_RUN_IFELSE([AC_LANG_SOURCE([[
7 #include <stdio.h>
8 #include <string.h>
9 int main(int argc, char **argv)
11         char foo[[3]];
12         snprintf(foo, 2, "12");
13         return strcmp(foo, "1") || snprintf(NULL, 0, "%d", 12) != 2;
14 }]])],[:],[ac_cv_func_snprintf_working=no],[:]))
16 if test "$ac_cv_func_snprintf_working" = yes; then
17         AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
19 if test "$ac_cv_func_snprintf_working" = yes; then
20 AC_NEED_PROTO([#include <stdio.h>],snprintf)
24 AC_DEFUN([AC_BROKEN_VSNPRINTF],[
25 AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
26 ac_cv_func_vsnprintf_working=yes
27 AC_RUN_IFELSE([AC_LANG_SOURCE([[
28 #include <stdio.h>
29 #include <string.h>
30 #include <stdarg.h>
32 int foo(int num, ...)
34         char bar[[3]];
35         va_list arg;
36         va_start(arg, num);
37         vsnprintf(bar, 2, "%s", arg);
38         va_end(arg);
39         return strcmp(bar, "1");
42 int bar(int num, int len, ...)
44         int r;
45         va_list arg;
46         va_start(arg, len);
47         r = vsnprintf(NULL, 0, "%s", arg);
48         va_end(arg);
49         return r != len;
52 int main(int argc, char **argv)
54         return foo(0, "12") || bar(0, 2, "12");
55 }]])],[:],[ac_cv_func_vsnprintf_working=no],[:]))
57 if test "$ac_cv_func_vsnprintf_working" = yes; then
58         AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
60 if test "$ac_cv_func_vsnprintf_working" = yes; then
61 AC_NEED_PROTO([#include <stdio.h>],vsnprintf)