From: Howard Chu Date: Mon, 2 Oct 2023 17:51:28 +0000 (+0100) Subject: ITS#10105 liblber lutil_debug: ensure msg ends with NL X-Git-Tag: OPENLDAP_REL_ENG_2_5_17~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=889e945d74f988e18bed04f9f44dfe709504426f;p=thirdparty%2Fopenldap.git ITS#10105 liblber lutil_debug: ensure msg ends with NL --- diff --git a/libraries/liblber/debug.c b/libraries/liblber/debug.c index 1744e58a33..1f4fdbb61a 100644 --- a/libraries/liblber/debug.c +++ b/libraries/liblber/debug.c @@ -43,12 +43,15 @@ void (lutil_debug)( int debug, int level, const char *fmt, ... ) { char buffer[4096]; va_list vl; + int len; if ( !(level & debug ) ) return; va_start( vl, fmt ); - vsnprintf( buffer, sizeof(buffer), fmt, vl ); + len = vsnprintf( buffer, sizeof(buffer), fmt, vl ); va_end( vl ); + if ( len >= sizeof(buffer)-2 ) + buffer[sizeof(buffer)-2] = '\n'; ber_pvt_log_print( buffer ); }