OSSP CVS Repository

ossp - Check-in [1075]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1075
Date: 2001-Oct-05 13:48:49 (local)
2001-Oct-05 11:48:49 (UTC)
User:rse
Branch:
Comment: use snprintf(3) if exists
Tickets:
Inspections:
Files:
ossp-pkg/sa/sa.ac      1.1 -> 1.2     1 inserted, 1 deleted
ossp-pkg/sa/sa.c      1.4 -> 1.5     5 inserted, 1 deleted

ossp-pkg/sa/sa.ac 1.1 -> 1.2

--- sa.ac        2001/10/02 13:27:44     1.1
+++ sa.ac        2001/10/05 11:48:49     1.2
@@ -39,6 +39,6 @@
     AC_CHECK_HEADERS(string.h sys/types.h sys/socket.h netdb.h netinet/in.h)
 
     #   check for system functions
-    AC_CHECK_FUNCS(inet_aton inet_pton inet_ntoa inet_ntop snprintf vsnprintf)
+    AC_CHECK_FUNCS(inet_aton inet_pton inet_ntoa inet_ntop snprintf)
 ])
 


ossp-pkg/sa/sa.c 1.4 -> 1.5

--- sa.c 2001/10/05 11:40:22     1.4
+++ sa.c 2001/10/05 11:48:49     1.5
@@ -160,7 +160,11 @@
             }
             else if (c == 'd') {
                 d = (int)va_arg(ap, int);
-                sprintf(ibuf, "%d", d);
+#ifdef HAVE_SNPRINTF
+                snprintf(ibuf, sizeof(ibuf), "%d", d); /* inherently secure */
+#else
+                sprintf(ibuf, "%d", d); /* nevertheless secure; see ibuf above */
+#endif
                 n = strlen(ibuf);
                 memcpy(bufptr, ibuf, n);
                 bufptr += n;

CVSTrac 2.0.1