Stop insecurely covering up for lack of snprintf and vsnprintf
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 7 Mar 2008 11:34:20 +0000 (13:34 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 7 Mar 2008 11:34:20 +0000 (13:34 +0200)
- we require C99 anyway
- snprintf is used unconditionally all around the tree
- if absolutely needed for portability, having insecure wrappers littered
  over the source is not the best way

lib/rpmps.c
rpmio/rpmlog.c
rpmio/rpmlua.c

index 6b24b88..26623c7 100644 (file)
@@ -207,25 +207,6 @@ int rpmpsTrim(rpmps ps, rpmps filter)
     return gotProblems;
 }
 
-#if !defined(HAVE_VSNPRINTF)
-static inline int vsnprintf(char * buf, int nb,
-       const char * fmt, va_list ap)
-{
-    return vsprintf(buf, fmt, ap);
-}
-#endif
-#if !defined(HAVE_SNPRINTF)
-static inline int snprintf(char * buf, int nb, const char * fmt, ...)
-{
-    va_list ap;
-    int rc;
-    va_start(ap, fmt);
-    rc = vsnprintf(buf, nb, fmt, ap);
-    va_end(ap);
-    return rc;
-}
-#endif
-
 rpmProblem rpmProblemCreate(rpmProblemType type,
                             const char * pkgNEVR,
                             fnpyKey key,
index cb3ef85..6c2ba32 100644 (file)
@@ -162,14 +162,6 @@ const char * rpmlogLevelPrefix(rpmlogLvl pri)
     return prefix;
 }
 
-#if !defined(HAVE_VSNPRINTF)
-static inline int vsnprintf(char * buf, int nb,
-       const char * fmt, va_list ap)
-{
-    return vsprintf(buf, fmt, ap);
-}
-#endif
-
 /* FIX: rpmlogMsgPrefix[] dependent, not unqualified */
 /* FIX: rpmlogMsgPrefix[] may be NULL */
 static void vrpmlog (unsigned code, const char *fmt, va_list ap)
index 3dc3ea3..c609d7c 100644 (file)
 
 #include "debug.h"
 
-#if !defined(HAVE_VSNPRINTF)
-static inline int vsnprintf(char * buf, int nb,
-                           const char * fmt, va_list ap)
-{
-    return vsprintf(buf, fmt, ap);
-}
-#endif
-
 #define INITSTATE(_lua, lua) \
     rpmlua lua = _lua ? _lua : \
            (globalLuaState ? globalLuaState : \