Ack

Regards, Vu

> -----Original Message-----
> From: Nguyen TK Luu [mailto:nguyen.tk....@dektech.com.au]
> Sent: Wednesday, February 22, 2017 11:03 AM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au;
> mahesh.va...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] osaf: fix saflog to handle long log record [#2313]
> 
>  src/osaf/saflog/saflog.c |  10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> 
> saflog is a utility function provided for other OpenSAF services
> to write log records to the system log stream.
> 
> Before this ticket, saflog limited the log record size to only 255
> chars, which made it not possible to write log records containing
> long dns (> 255 chars).
> 
> This ticket increases the log record size limit to 65,535 chars
> (SA_LOG_MAX_RECORD_SIZE) to allow logging long log records that
> may contain long dns.
> 
> diff --git a/src/osaf/saflog/saflog.c b/src/osaf/saflog/saflog.c
> --- a/src/osaf/saflog/saflog.c
> +++ b/src/osaf/saflog/saflog.c
> @@ -1,6 +1,7 @@
>  /*      -*- OpenSAF  -*-
>   *
>   * (C) Copyright 2010 The OpenSAF Foundation
> + * (C) Copyright 2017 Ericsson AB. All Rights Reserved.
>   *
>   * This program is distributed in the hope that it will be useful, but
>   * WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY
> @@ -58,12 +59,19 @@ void saflog(int priority, const SaNameT
>       SaLogRecordT logRecord;
>       SaLogBufferT logBuffer;
>       va_list ap;
> -     char str[256];
> +     char str[SA_LOG_MAX_RECORD_SIZE + 1];
> +     /* SA_LOG_MAX_RECORD_SIZE = 65535
> +      * This will allow logging of record containing long dns */
> 
>       va_start(ap, format);
>       logBuffer.logBufSize = vsnprintf(str, sizeof(str), format, ap);
>       va_end(ap);
> 
> +     if (logBuffer.logBufSize > SA_LOG_MAX_RECORD_SIZE) {
> +             syslog(LOG_INFO, "saflog write FAILED: log record size > %u
> max limit", SA_LOG_MAX_RECORD_SIZE);
> +             return;
> +     }
> +
>       if (!initialized) {
>               SaVersionT logVersion = { 'A', 2, 1 };
>               SaNameT stream_name;


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to