mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Use LINE_MAX instead of BUFSIZ. Per POSIX, LINE_MAX should be at least 2K.
For ITS#4651
This commit is contained in:
parent
9bc2cd3987
commit
d35d3b2026
@ -35,4 +35,14 @@
|
|||||||
# define EXIT_FAILURE 1
|
# define EXIT_FAILURE 1
|
||||||
#endif
|
#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 */
|
#endif /* _AC_STDLIB_H */
|
||||||
|
@ -1154,7 +1154,7 @@ slap_cf_aux_table_parse( const char *word, void *dst, slap_cf_aux_table *tab0, L
|
|||||||
int
|
int
|
||||||
slap_cf_aux_table_unparse( void *src, struct berval *bv, slap_cf_aux_table *tab0 )
|
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;
|
slap_cf_aux_table *tab;
|
||||||
struct berval tmp;
|
struct berval tmp;
|
||||||
|
|
||||||
@ -1610,7 +1610,7 @@ strtok_quote( char *line, char *sep, char **quote_ptr )
|
|||||||
return( tmp );
|
return( tmp );
|
||||||
}
|
}
|
||||||
|
|
||||||
static char buf[BUFSIZ];
|
static char buf[AC_LINE_MAX];
|
||||||
static char *line;
|
static char *line;
|
||||||
static size_t lmax, lcur;
|
static size_t lmax, lcur;
|
||||||
|
|
||||||
@ -1618,7 +1618,7 @@ static size_t lmax, lcur;
|
|||||||
do { \
|
do { \
|
||||||
size_t len = strlen( buf ); \
|
size_t len = strlen( buf ); \
|
||||||
while ( lcur + len + 1 > lmax ) { \
|
while ( lcur + len + 1 > lmax ) { \
|
||||||
lmax += BUFSIZ; \
|
lmax += AC_LINE_MAX; \
|
||||||
line = (char *) ch_realloc( line, lmax ); \
|
line = (char *) ch_realloc( line, lmax ); \
|
||||||
} \
|
} \
|
||||||
strcpy( line + lcur, buf ); \
|
strcpy( line + lcur, buf ); \
|
||||||
|
@ -322,7 +322,7 @@ fail:
|
|||||||
* clients.
|
* clients.
|
||||||
*/
|
*/
|
||||||
for ( i=LDAP_VERSION3; i<=LDAP_VERSION_MAX; i++ ) {
|
for ( i=LDAP_VERSION3; i<=LDAP_VERSION_MAX; i++ ) {
|
||||||
char buf[BUFSIZ];
|
char buf[sizeof("255")];
|
||||||
snprintf(buf, sizeof buf, "%d", i);
|
snprintf(buf, sizeof buf, "%d", i);
|
||||||
val.bv_val = buf;
|
val.bv_val = buf;
|
||||||
val.bv_len = strlen( val.bv_val );
|
val.bv_len = strlen( val.bv_val );
|
||||||
|
Loading…
Reference in New Issue
Block a user