[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:47:01
[Download RAW message or body]

On Sat, Dec 07, 2002 at 05:39:55PM +0100, Dirk Mueller wrote:
> On Sam, 07 Dez 2002, Oswald Buddenhagen wrote:
> 
> > ... and consequently the "-1" should go away.
> 
> Write a configure check and commit it. 
> 
here we go ...
the test checks whether literal strings, replaced strings and replaced
integers are correctly truncated. this should be paranoid enough.
ok?

greetings

-- 
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:41:35 -0000
@@ -754,6 +754,37 @@
 ])
 
 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[9] = 55;
+    snprintf(buf, 10, "0123456789");
+    if (buf[8])
+	return 1;
+    /* extra paranoia */
+    buf[9] = 55;
+    snprintf(buf, 10, "01234%s", "56789");
+    if (buf[9])
+	return 1;
+    buf[9] = 55;
+    snprintf(buf, 10, "01234%d", 56789);
+    if (buf[9])
+	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