[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: kdelibs/kdoctools
From: Oswald Buddenhagen <ossi () kde ! org>
Date: 2002-12-08 2:56:36
[Download RAW message or body]
On Sun, Dec 08, 2002 at 03:47:01AM +0100, Oswald Buddenhagen wrote:
> here we go ...
>
> + buf[9] = 55;
> + snprintf(buf, 10, "0123456789");
> + if (buf[8])
^
> + return 1;
>
heh, that was my test whether it actually works. too bad i forgot to
revert it. :}
attached is a corrected and even more paranoid version.
--
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
["acinclude.m4.in.diff" (text/plain)]
Index: acinclude.m4.in
===================================================================
RCS file: /home/kde/kde-common/admin/acinclude.m4.in,v
retrieving revision 2.305
diff -u -r2.305 acinclude.m4.in
--- acinclude.m4.in 3 Dec 2002 10:50:38 -0000 2.305
+++ acinclude.m4.in 8 Dec 2002 02:50:42 -0000
@@ -754,6 +754,40 @@
])
AC_CHECK_FUNCS([vsnprintf snprintf])
+if test x$ac_cv_func_snprintf = xyes; then
+ AC_MSG_CHECKING([whether snprintf is safe])
+ AC_TRY_RUN([
+#include <stdio.h>
+
+int main()
+{
+ char buf[11];
+
+ buf[10] = 'O';
+ buf[9] = 'B';
+ snprintf(buf, 10, "0123456789");
+ if (buf[9])
+ return 1;
+ /* extra paranoia */
+ buf[9] = 'B';
+ snprintf(buf, 10, "01234%s", "56789");
+ if (buf[9])
+ return 1;
+ buf[9] = 'B';
+ snprintf(buf, 10, "01234%d", 56789);
+ if (buf[9])
+ return 1;
+ if (buf[10] != 'O')
+ return 1;
+ return 0;
+}
+ ], [AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)
+ AC_MSG_ERROR([The snprintf() implementation in your c library
+is seriously broken. Upgrade it and try again.])],
+ [AC_MSG_RESULT(unknown)
+ AC_MSG_WARN([Cannot test whether snprintf() works (cross-compile)])])
+fi
AH_VERBATIM(_TRU64,[
/*
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic