Re: [PATCH 5/8] logger: fix rfc5424 format crash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2015-03-16 11:49 GMT+01:00 Karel Zak <kzak@xxxxxxxxxx>:
> On Sun, Mar 15, 2015 at 12:54:51PM +0000, Sami Kerola wrote:
>> $ logger --rfc5424=notq message
>> Segmentation fault (core dumped)
>
> Not sure if Rainer is subscribed to the list, so please keep him in CC.


I am since a couple of day (but via a gmail alias for easier filtering).

>
>> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
>> ---
>>  misc-utils/logger.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/misc-utils/logger.c b/misc-utils/logger.c
>> index 838d225..b007377 100644
>> --- a/misc-utils/logger.c
>> +++ b/misc-utils/logger.c
>> @@ -476,7 +476,8 @@ static void syslog_rfc5424_header(struct logger_ctl *const ctl)
>>  #endif
>>                       xasprintf(&structured_data,
>>                                "[timeQuality tzKnown=\"1\" isSynced=\"0\"]");
>> -     }
>> +     } else
>> +             structured_data = xstrdup("");
>
> RFC5424:
>
>     STRUCTURED-DATA = NILVALUE / 1*SD-ELEMENT
>
>     NILVALUE        = "-"
>
>
> ... so I guess "" is bad idea. I'll fix it before commit.

yeah, I overlooked that case. I should really find time to work on
"make check"...

The best thing to do is use

= xstrdup(NILVALUE)

I defined NILVALUE exactly for those cases (see rest of code).

Rainer

PS: I've been silent for a couple of days because my main projects
demand attention. Will soon post more again here.

>
>     Karel
>
> --
>  Karel Zak  <kzak@xxxxxxxxxx>
>  http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux