]> git.sur5r.net Git - openldap/commitdiff
Use LINE_MAX instead of BUFSIZ. Per POSIX, LINE_MAX should be at least 2K.
authorKurt Zeilenga <kurt@openldap.org>
Fri, 25 Aug 2006 20:05:14 +0000 (20:05 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 25 Aug 2006 20:05:14 +0000 (20:05 +0000)
For ITS#4651

include/ac/stdlib.h
servers/slapd/config.c
servers/slapd/root_dse.c

index 560ea8170a8ad82f5baa59c28e174eab08c2df97..3ddabbb9da7cb1838fbfec0e479bd5cf948e448a 100644 (file)
 #      define EXIT_FAILURE 1
 #endif
 
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#if defined(LINE_MAX) 
+#      define AC_LINE_MAX LINE_MAX
+#else
+#      define AC_LINE_MAX 2048 /* POSIX MIN */
+#endif
+
 #endif /* _AC_STDLIB_H */
index 5ff1c3776b1f37974b0644b7f31338f619c30860..39692b4ca230c357dbab6beaa80b1ffd71d8d5cc 100644 (file)
@@ -1154,7 +1154,7 @@ slap_cf_aux_table_parse( const char *word, void *dst, slap_cf_aux_table *tab0, L
 int
 slap_cf_aux_table_unparse( void *src, struct berval *bv, slap_cf_aux_table *tab0 )
 {
-       char buf[BUFSIZ], *ptr;
+       char buf[AC_LINE_MAX], *ptr;
        slap_cf_aux_table *tab;
        struct berval tmp;
 
@@ -1610,7 +1610,7 @@ strtok_quote( char *line, char *sep, char **quote_ptr )
        return( tmp );
 }
 
-static char    buf[BUFSIZ];
+static char    buf[AC_LINE_MAX];
 static char    *line;
 static size_t lmax, lcur;
 
@@ -1618,7 +1618,7 @@ static size_t lmax, lcur;
        do { \
                size_t len = strlen( buf ); \
                while ( lcur + len + 1 > lmax ) { \
-                       lmax += BUFSIZ; \
+                       lmax += AC_LINE_MAX; \
                        line = (char *) ch_realloc( line, lmax ); \
                } \
                strcpy( line + lcur, buf ); \
index cffae770c00181157c6a0815e94ba3ace63d3729..38f9f670b23c86c41211f604cb645a30cfccb108 100644 (file)
@@ -322,7 +322,7 @@ fail:
                 * clients.
                 */
        for ( i=LDAP_VERSION3; i<=LDAP_VERSION_MAX; i++ ) {
-               char buf[BUFSIZ];
+               char buf[sizeof("255")];
                snprintf(buf, sizeof buf, "%d", i);
                val.bv_val = buf;
                val.bv_len = strlen( val.bv_val );