Limit log level string when building message
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Thu, 29 Jan 2015 12:32:24 +0000 (14:32 +0200)
committerNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Fri, 30 Jan 2015 16:16:32 +0000 (18:16 +0200)
commita8f4cdea102441523f875263ee434db82adab497
tree45fec89a2e6c55a4623b567aaa8913b9bb13f597
parentba452500fec5456d56cd05496e176b6f5b6e38f9
Limit log level string when building message

Use strncat instead of strcat to limit the length of copied log level
name in radlog_request. This makes the code easier to reason about
overall and to make sure no buffer overflow happens.

This fixes the following Coverity error:

Error: STRING_OVERFLOW (CWE-120):
freeradius-server-2.2.6/src/main/log.c:310: fixed_size_dest: You might overrun the 1024 byte fixed-size string "buffer" by copying the return value of "fr_int2str" without checking the length.
src/main/log.c