From: Howard Chu Date: Fri, 31 Jan 2003 20:38:25 +0000 (+0000) Subject: Fix statslog of big attr names X-Git-Tag: NO_SLAP_OP_BLOCKS~456 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6038e912ddf7f58412982dc5f9f976e51d681a22;p=openldap Fix statslog of big attr names --- diff --git a/servers/slapd/search.c b/servers/slapd/search.c index c331ed4583..b679e1270e 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -228,14 +228,18 @@ do_search( if ( StatslogTest( LDAP_DEBUG_STATS ) ) { char abuf[BUFSIZ/2], *ptr = abuf; - int len = 0; + int len = 0, alen; Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH base=\"%s\" scope=%d filter=\"%s\"\n", op->o_connid, op->o_opid, pbase.bv_val, scope, fstr.bv_val ); for ( i = 0; i sizeof(abuf)) { + alen = an[i].an_name.bv_len; + if (alen >= sizeof(abuf)) { + alen = sizeof(abuf)-1; + } + if (len && (len + 1 + alen >= sizeof(abuf))) { Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n", op->o_connid, op->o_opid, abuf, 0, 0 ); len = 0; @@ -245,8 +249,9 @@ do_search( *ptr++ = ' '; len++; } - ptr = lutil_strcopy(ptr, an[i].an_name.bv_val); - len += an[i].an_name.bv_len; + ptr = lutil_strncopy(ptr, an[i].an_name.bv_val, alen); + len += alen; + *ptr = '\0'; } if (len) { Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n",